getDetectedNodes() {
+ return Collections.unmodifiableList(detectedNodes);
+ }
+
+ @Nonnull
+ public static ILanguageSupport<
+ SquidCheck>, AstNode, Symbol, SquidAstVisitorContext extends Grammar>>
+ getLanguageSupport() {
+ return cxxLanguageSupport;
+ }
+
+ public static void reset() {
+ cxxLanguageSupport = LanguageSupporter.cxxLanguageSupporter();
+ detectedNodes = new ArrayList<>();
+ }
+}
diff --git a/cpp/src/main/java/com/ibm/plugin/CxxCheckRegistrar.java b/cpp/src/main/java/com/ibm/plugin/CxxCheckRegistrar.java
new file mode 100644
index 000000000..98877cfd1
--- /dev/null
+++ b/cpp/src/main/java/com/ibm/plugin/CxxCheckRegistrar.java
@@ -0,0 +1,48 @@
+/*
+ * Sonar Cryptography Plugin
+ * Copyright (C) 2024 PQCA
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ibm.plugin;
+
+import java.util.List;
+import org.sonar.cxx.squidbridge.api.CxxCustomRuleRepository;
+import org.sonarsource.api.sonarlint.SonarLintSide;
+
+/**
+ * Registers C++ cryptography detection rules with the sonar-cxx analysis framework.
+ *
+ * This class implements the {@link CxxCustomRuleRepository} interface provided by sonar-cxx,
+ * which allows external plugins to register custom checks that will be executed during C++ code
+ * analysis.
+ *
+ *
The sonar-cxx plugin will discover this class via service loading and invoke the {@link
+ * #checkClasses()} method to obtain the list of check classes to instantiate and run.
+ */
+@SonarLintSide
+public class CxxCheckRegistrar implements CxxCustomRuleRepository {
+
+ @Override
+ public String repositoryKey() {
+ return CxxScannerRuleDefinition.REPOSITORY_KEY;
+ }
+
+ @Override
+ public List> checkClasses() {
+ return CxxRuleList.getChecks();
+ }
+}
diff --git a/cpp/src/main/java/com/ibm/plugin/CxxRuleList.java b/cpp/src/main/java/com/ibm/plugin/CxxRuleList.java
new file mode 100644
index 000000000..867164c28
--- /dev/null
+++ b/cpp/src/main/java/com/ibm/plugin/CxxRuleList.java
@@ -0,0 +1,48 @@
+/*
+ * Sonar Cryptography Plugin
+ * Copyright (C) 2024 PQCA
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ibm.plugin;
+
+import com.ibm.plugin.rules.CxxInventoryRule;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.Nonnull;
+
+public final class CxxRuleList {
+
+ private CxxRuleList() {}
+
+ public static @Nonnull List> getChecks() {
+ List> checks = new ArrayList<>();
+ checks.addAll(getCxxChecks());
+ checks.addAll(getCxxTestChecks());
+ return Collections.unmodifiableList(checks);
+ }
+
+ /** These rules are going to target MAIN code only */
+ public static @Nonnull List> getCxxChecks() {
+ return List.of(CxxInventoryRule.class);
+ }
+
+ /** These rules are going to target TEST code only */
+ public static @Nonnull List> getCxxTestChecks() {
+ return List.of();
+ }
+}
diff --git a/cpp/src/main/java/com/ibm/plugin/CxxScannerRuleDefinition.java b/cpp/src/main/java/com/ibm/plugin/CxxScannerRuleDefinition.java
new file mode 100644
index 000000000..5fe5aa857
--- /dev/null
+++ b/cpp/src/main/java/com/ibm/plugin/CxxScannerRuleDefinition.java
@@ -0,0 +1,61 @@
+/*
+ * Sonar Cryptography Plugin
+ * Copyright (C) 2024 PQCA
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ibm.plugin;
+
+import java.util.Collections;
+import java.util.Objects;
+import java.util.Set;
+import org.sonar.api.SonarRuntime;
+import org.sonar.api.server.rule.RulesDefinition;
+import org.sonarsource.analyzer.commons.RuleMetadataLoader;
+
+public class CxxScannerRuleDefinition implements RulesDefinition {
+ public static final String REPOSITORY_KEY = "sonar-cpp-crypto";
+ public static final String REPOSITORY_NAME = "Sonar Cryptography";
+ public static final String LANGUAGE_KEY = "cxx";
+
+ // Add the rule keys of the rules which need to be considered as template-rules
+ private static final Set RULE_TEMPLATES_KEY = Collections.emptySet();
+
+ private static final String RESOURCE_BASE_PATH = "/org/sonar/l10n/cpp/rules/cpp";
+
+ private final SonarRuntime sonarRuntime;
+
+ public CxxScannerRuleDefinition(SonarRuntime sonarRuntime) {
+ this.sonarRuntime = sonarRuntime;
+ }
+
+ @Override
+ public void define(Context context) {
+ NewRepository repository =
+ context.createRepository(REPOSITORY_KEY, LANGUAGE_KEY).setName(REPOSITORY_NAME);
+
+ RuleMetadataLoader ruleMetadataLoader =
+ new RuleMetadataLoader(RESOURCE_BASE_PATH, this.sonarRuntime);
+ ruleMetadataLoader.addRulesByAnnotatedClass(repository, CxxRuleList.getChecks());
+
+ RULE_TEMPLATES_KEY.stream()
+ .map(repository::rule)
+ .filter(Objects::nonNull)
+ .forEach(rule -> rule.setTemplate(true));
+
+ repository.done();
+ }
+}
diff --git a/cpp/src/main/java/com/ibm/plugin/rules/CxxInventoryRule.java b/cpp/src/main/java/com/ibm/plugin/rules/CxxInventoryRule.java
new file mode 100644
index 000000000..367265768
--- /dev/null
+++ b/cpp/src/main/java/com/ibm/plugin/rules/CxxInventoryRule.java
@@ -0,0 +1,58 @@
+/*
+ * Sonar Cryptography Plugin
+ * Copyright (C) 2024 PQCA
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ibm.plugin.rules;
+
+import com.ibm.engine.rule.IDetectionRule;
+import com.ibm.mapper.model.INode;
+import com.ibm.plugin.rules.detection.CxxBaseDetectionRule;
+import com.ibm.plugin.rules.detection.CxxDetectionRules;
+import com.ibm.plugin.translation.reorganizer.CxxReorganizerRules;
+import com.ibm.rules.InventoryRule;
+import com.ibm.rules.issue.Issue;
+import com.sonar.cxx.sslr.api.AstNode;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.sonar.check.Rule;
+
+/**
+ * C++ Inventory Rule for detecting cryptographic assets.
+ *
+ * This rule scans C++ source files for cryptographic API usage and reports findings for
+ * inventory purposes. Detected assets are exported to the Cryptographic Bill of Materials (CBOM)
+ * output.
+ */
+@Rule(key = "Inventory")
+public class CxxInventoryRule extends CxxBaseDetectionRule {
+
+ public CxxInventoryRule() {
+ super(true, CxxDetectionRules.rules(), CxxReorganizerRules.rules());
+ }
+
+ protected CxxInventoryRule(@Nonnull List> detectionRules) {
+ super(true, detectionRules, CxxReorganizerRules.rules());
+ }
+
+ @Override
+ @Nonnull
+ public List> report(
+ @Nonnull AstNode markerTree, @Nonnull List translatedNodes) {
+ return new InventoryRule().report(markerTree, translatedNodes);
+ }
+}
diff --git a/cpp/src/main/java/com/ibm/plugin/rules/detection/CxxBaseDetectionRule.java b/cpp/src/main/java/com/ibm/plugin/rules/detection/CxxBaseDetectionRule.java
new file mode 100644
index 000000000..c1e4fee9a
--- /dev/null
+++ b/cpp/src/main/java/com/ibm/plugin/rules/detection/CxxBaseDetectionRule.java
@@ -0,0 +1,173 @@
+/*
+ * Sonar Cryptography Plugin
+ * Copyright (C) 2024 PQCA
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ibm.plugin.rules.detection;
+
+import com.ibm.common.IObserver;
+import com.ibm.engine.detection.Finding;
+import com.ibm.engine.executive.DetectionExecutive;
+import com.ibm.engine.language.cxx.CxxScanContext;
+import com.ibm.engine.rule.IDetectionRule;
+import com.ibm.mapper.model.INode;
+import com.ibm.mapper.reorganizer.IReorganizerRule;
+import com.ibm.plugin.CxxAggregator;
+import com.ibm.plugin.translation.CxxTranslationProcess;
+import com.ibm.plugin.translation.reorganizer.CxxReorganizerRules;
+import com.ibm.rules.IReportableDetectionRule;
+import com.ibm.rules.issue.Issue;
+import com.sonar.cxx.sslr.api.AstNode;
+import com.sonar.cxx.sslr.api.AstNodeType;
+import com.sonar.cxx.sslr.api.Grammar;
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.sonar.cxx.parser.CxxGrammarImpl;
+import org.sonar.cxx.squidbridge.SquidAstVisitorContext;
+import org.sonar.cxx.squidbridge.api.AstNodeTraversal;
+import org.sonar.cxx.squidbridge.api.Symbol;
+import org.sonar.cxx.squidbridge.checks.SquidCheck;
+import org.sonar.cxx.utils.CxxAstNodeHelper;
+
+/**
+ * Base class for C++ cryptography detection rules.
+ *
+ * This class extends {@link SquidCheck} to integrate with the sonar-cxx analysis framework and
+ * implements the observer pattern to receive detection findings from the engine.
+ *
+ *
The detection flow works as follows:
+ *
+ *
+ * - sonar-cxx calls {@link #visitFile(AstNode)} for each C++ file
+ *
- We traverse the AST looking for function calls and constructor invocations
+ *
- For each relevant node, we create a {@link DetectionExecutive} and start detection
+ *
- When a finding is detected, {@link #update(Finding)} is called
+ *
- The finding is translated, reorganized, enriched, and optionally reported
+ *
+ */
+public abstract class CxxBaseDetectionRule extends SquidCheck
+ implements IObserver<
+ Finding<
+ SquidCheck>,
+ AstNode,
+ Symbol,
+ SquidAstVisitorContext extends Grammar>>>,
+ IReportableDetectionRule {
+
+ /** Node types to detect: function calls, new expressions, and enum specifiers. */
+ private static final AstNodeType[] DETECTION_NODE_TYPES = {
+ CxxGrammarImpl.postfixExpression, CxxGrammarImpl.newExpression, CxxGrammarImpl.enumSpecifier
+ };
+
+ private final boolean isInventory;
+ @Nonnull protected final CxxTranslationProcess cxxTranslationProcess;
+ @Nonnull protected final List> detectionRules;
+
+ protected CxxBaseDetectionRule() {
+ this.isInventory = false;
+ this.detectionRules = CxxDetectionRules.rules();
+ this.cxxTranslationProcess = new CxxTranslationProcess(CxxReorganizerRules.rules());
+ }
+
+ protected CxxBaseDetectionRule(
+ final boolean isInventory,
+ @Nonnull List> detectionRules,
+ @Nonnull List reorganizerRules) {
+ this.isInventory = isInventory;
+ this.detectionRules = detectionRules;
+ this.cxxTranslationProcess = new CxxTranslationProcess(reorganizerRules);
+ }
+
+ /**
+ * Called when visiting a file. Traverses the AST to find detection targets.
+ *
+ * @param astNode The root AST node of the file
+ */
+ @Override
+ public void visitFile(@Nonnull AstNode astNode) {
+ // Traverse the entire AST looking for function calls, new expressions, and enums
+ AstNodeTraversal.traverse(astNode, DETECTION_NODE_TYPES, this::processNode);
+ }
+
+ /**
+ * Processes a single AST node for potential cryptographic detection.
+ *
+ * @param node The AST node to process
+ */
+ private void processNode(@Nonnull AstNode node) {
+ // Only process actual function calls and constructor calls, not all postfix expressions
+ if (node.is(CxxGrammarImpl.postfixExpression)) {
+ if (!CxxAstNodeHelper.isFunctionCall(node)
+ && !CxxAstNodeHelper.isConstructorCall(node)) {
+ return;
+ }
+ }
+
+ detectionRules.forEach(
+ rule -> {
+ DetectionExecutive<
+ SquidCheck>,
+ AstNode,
+ Symbol,
+ SquidAstVisitorContext extends Grammar>>
+ detectionExecutive =
+ CxxAggregator.getLanguageSupport()
+ .createDetectionExecutive(
+ node,
+ rule,
+ new CxxScanContext(this.getContext()));
+ detectionExecutive.subscribe(this);
+ detectionExecutive.start();
+ });
+ }
+
+ /**
+ * Called when a finding is detected by the engine.
+ *
+ * @param finding A finding containing detection store information.
+ */
+ @Override
+ public void update(
+ @Nonnull
+ Finding<
+ SquidCheck>,
+ AstNode,
+ Symbol,
+ SquidAstVisitorContext extends Grammar>>
+ finding) {
+ final List nodes = cxxTranslationProcess.initiate(finding.detectionStore());
+ if (isInventory) {
+ CxxAggregator.addNodes(nodes);
+ }
+ // report
+ this.report(finding.getMarkerTree(), nodes)
+ .forEach(
+ issue ->
+ finding.detectionStore()
+ .getScanContext()
+ .reportIssue(this, issue.tree(), issue.message()));
+ }
+
+ @Override
+ @Nonnull
+ public List> report(
+ @Nonnull AstNode markerTree, @Nonnull List translatedNodes) {
+ // override by higher level rule, to report an issue
+ return Collections.emptyList();
+ }
+}
diff --git a/cpp/src/main/java/com/ibm/plugin/rules/detection/CxxDetectionRules.java b/cpp/src/main/java/com/ibm/plugin/rules/detection/CxxDetectionRules.java
new file mode 100644
index 000000000..fe40c21cf
--- /dev/null
+++ b/cpp/src/main/java/com/ibm/plugin/rules/detection/CxxDetectionRules.java
@@ -0,0 +1,58 @@
+/*
+ * Sonar Cryptography Plugin
+ * Copyright (C) 2024 PQCA
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ibm.plugin.rules.detection;
+
+import com.ibm.engine.rule.IDetectionRule;
+import com.ibm.plugin.rules.detection.openssl.OpenSSLDetectionRules;
+import com.sonar.cxx.sslr.api.AstNode;
+import java.util.List;
+import java.util.stream.Stream;
+import javax.annotation.Nonnull;
+
+/**
+ * Registry of C++ cryptography detection rules.
+ *
+ * This class aggregates all detection rules for C++ cryptographic libraries. Detection rules are
+ * organized by library (e.g., OpenSSL, BoringSSL, libsodium).
+ *
+ *
To add new detection rules:
+ *
+ *
+ * - Create a new package under {@code rules.detection} for the library
+ *
- Create detection rule classes following the pattern in Java module
+ *
- Create a {@code *DetectionRules} class that returns all rules for the library
+ *
- Add the rules to the stream in {@link #rules()}
+ *
+ */
+public final class CxxDetectionRules {
+ private CxxDetectionRules() {
+ // private
+ }
+
+ /**
+ * Returns all C++ cryptography detection rules.
+ *
+ * @return List of all detection rules
+ */
+ @Nonnull
+ public static List> rules() {
+ return Stream.of(OpenSSLDetectionRules.rules().stream()).flatMap(i -> i).toList();
+ }
+}
diff --git a/cpp/src/main/java/com/ibm/plugin/rules/detection/openssl/OpenSSLDetectionRules.java b/cpp/src/main/java/com/ibm/plugin/rules/detection/openssl/OpenSSLDetectionRules.java
new file mode 100644
index 000000000..59c7e76da
--- /dev/null
+++ b/cpp/src/main/java/com/ibm/plugin/rules/detection/openssl/OpenSSLDetectionRules.java
@@ -0,0 +1,89 @@
+/*
+ * Sonar Cryptography Plugin
+ * Copyright (C) 2024 PQCA
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ibm.plugin.rules.detection.openssl;
+
+import com.ibm.engine.rule.IDetectionRule;
+import com.ibm.plugin.rules.detection.openssl.cipher.OpenSSLEvpCipher;
+import com.ibm.plugin.rules.detection.openssl.cipher.OpenSSLEvpCipherFetch;
+import com.ibm.plugin.rules.detection.openssl.digest.OpenSSLEvpMessageDigest;
+import com.ibm.plugin.rules.detection.openssl.kdf.OpenSSLEvpKdf;
+import com.ibm.plugin.rules.detection.openssl.keyagreement.OpenSSLEvpKeyAgreement;
+import com.ibm.plugin.rules.detection.openssl.keygen.OpenSSLEvpKeyGen;
+import com.ibm.plugin.rules.detection.openssl.legacy.OpenSSLLegacyCipher;
+import com.ibm.plugin.rules.detection.openssl.legacy.OpenSSLLegacyDh;
+import com.ibm.plugin.rules.detection.openssl.legacy.OpenSSLLegacyDigest;
+import com.ibm.plugin.rules.detection.openssl.legacy.OpenSSLLegacyDsa;
+import com.ibm.plugin.rules.detection.openssl.legacy.OpenSSLLegacyEc;
+import com.ibm.plugin.rules.detection.openssl.legacy.OpenSSLLegacyMac;
+import com.ibm.plugin.rules.detection.openssl.legacy.OpenSSLLegacyRsa;
+import com.ibm.plugin.rules.detection.openssl.mac.OpenSSLEvpMac;
+import com.ibm.plugin.rules.detection.openssl.rand.OpenSSLRand;
+import com.ibm.plugin.rules.detection.openssl.signature.OpenSSLEvpSignature;
+import com.ibm.plugin.rules.detection.openssl.ssl.OpenSSLLibssl;
+import com.sonar.cxx.sslr.api.AstNode;
+import java.util.List;
+import java.util.stream.Stream;
+import javax.annotation.Nonnull;
+
+/**
+ * Aggregates all OpenSSL cryptography detection rules.
+ *
+ * This class collects detection rules from all OpenSSL API categories:
+ *
+ *
+ * - EVP message digest functions ({@code EVP_sha256}, {@code EVP_md5}, etc.)
+ *
- EVP cipher functions ({@code EVP_aes_256_gcm}, {@code EVP_chacha20_poly1305}, etc.)
+ *
- EVP MAC functions ({@code EVP_MAC_fetch} with HMAC, CMAC, GMAC, etc.)
+ *
- SSL/TLS protocol functions ({@code TLS_method}, {@code SSL_CTX_new}, etc.)
+ *
+ */
+public final class OpenSSLDetectionRules {
+
+ private OpenSSLDetectionRules() {
+ // private
+ }
+
+ @Nonnull
+ public static List> rules() {
+ return Stream.of(
+ // EVP API - Modern OpenSSL 3.x functions
+ OpenSSLEvpCipher.rules().stream(),
+ OpenSSLEvpCipherFetch.rules().stream(),
+ OpenSSLEvpMessageDigest.rules().stream(),
+ OpenSSLEvpMac.rules().stream(),
+ OpenSSLEvpSignature.rules().stream(),
+ OpenSSLEvpKeyGen.rules().stream(),
+ OpenSSLEvpKdf.rules().stream(),
+ OpenSSLEvpKeyAgreement.rules().stream(),
+ OpenSSLRand.rules().stream(),
+ // Legacy API - Deprecated but widely used
+ OpenSSLLegacyCipher.rules().stream(),
+ OpenSSLLegacyDigest.rules().stream(),
+ OpenSSLLegacyMac.rules().stream(),
+ OpenSSLLegacyRsa.rules().stream(),
+ OpenSSLLegacyDsa.rules().stream(),
+ OpenSSLLegacyEc.rules().stream(),
+ OpenSSLLegacyDh.rules().stream(),
+ // SSL/TLS Protocol API
+ OpenSSLLibssl.rules().stream())
+ .flatMap(i -> i)
+ .toList();
+ }
+}
diff --git a/cpp/src/main/java/com/ibm/plugin/rules/detection/openssl/cipher/OpenSSLEvpCipher.java b/cpp/src/main/java/com/ibm/plugin/rules/detection/openssl/cipher/OpenSSLEvpCipher.java
new file mode 100644
index 000000000..321fd9046
--- /dev/null
+++ b/cpp/src/main/java/com/ibm/plugin/rules/detection/openssl/cipher/OpenSSLEvpCipher.java
@@ -0,0 +1,2170 @@
+/*
+ * Sonar Cryptography Plugin
+ * Copyright (C) 2024 PQCA
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ibm.plugin.rules.detection.openssl.cipher;
+
+import com.ibm.engine.model.context.CipherContext;
+import com.ibm.engine.model.factory.ValueActionFactory;
+import com.ibm.engine.rule.IDetectionRule;
+import com.ibm.engine.rule.builder.DetectionRuleBuilder;
+import com.sonar.cxx.sslr.api.AstNode;
+import java.util.List;
+import javax.annotation.Nonnull;
+
+/**
+ * Detection rules for OpenSSL EVP cipher algorithm specifiers.
+ *
+ * These rules detect calls to OpenSSL functions that return EVP_CIPHER pointers, identifying the
+ * specific cipher algorithm, key size, and mode of operation. Each function (e.g., {@code
+ * EVP_aes_256_gcm()}) maps to a known cipher specification.
+ *
+ *
Covers all OpenSSL symmetric ciphers including AES, Camellia, ARIA, SM4, DES, ChaCha20,
+ * Blowfish, CAST5, RC2/4/5, IDEA, and SEED.
+ */
+@SuppressWarnings("java:S1192")
+public final class OpenSSLEvpCipher {
+
+ private static final String BUNDLE = "OpenSSL";
+
+ // ====================================================================
+ // AES (Advanced Encryption Standard)
+ // ====================================================================
+
+ // AES-128
+ private static final IDetectionRule EVP_AES_128_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_GCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_gcm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-GCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_CCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_ccm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-CCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_XTS =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_xts")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-XTS"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_OCB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_ocb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-OCB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_WRAP =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_wrap")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-WRAP"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_128_WRAP_PAD =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_128_wrap_pad")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-128-WRAP-PAD"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // AES-192
+ private static final IDetectionRule EVP_AES_192_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_GCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_gcm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-GCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_CCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_ccm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-CCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_OCB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_ocb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-OCB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_WRAP =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_wrap")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-WRAP"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_192_WRAP_PAD =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_192_wrap_pad")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-192-WRAP-PAD"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // AES-256
+ private static final IDetectionRule EVP_AES_256_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_GCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_gcm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-GCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_CCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_ccm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-CCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_XTS =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_xts")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-XTS"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_OCB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_ocb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-OCB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_WRAP =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_wrap")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-WRAP"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_AES_256_WRAP_PAD =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aes_256_wrap_pad")
+ .shouldBeDetectedAs(new ValueActionFactory<>("AES-256-WRAP-PAD"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // ====================================================================
+ // Camellia
+ // ====================================================================
+
+ // Camellia-128
+ private static final IDetectionRule EVP_CAMELLIA_128_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_128_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-128-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_128_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_128_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-128-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_128_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_128_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-128-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_128_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_128_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-128-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_128_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_128_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-128-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_128_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_128_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-128-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_128_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_128_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-128-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_128_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_128_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-128-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // Camellia-192
+ private static final IDetectionRule EVP_CAMELLIA_192_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_192_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-192-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_192_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_192_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-192-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_192_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_192_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-192-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_192_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_192_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-192-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_192_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_192_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-192-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_192_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_192_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-192-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_192_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_192_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-192-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_192_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_192_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-192-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // Camellia-256
+ private static final IDetectionRule EVP_CAMELLIA_256_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_256_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-256-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_256_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_256_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-256-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_256_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_256_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-256-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_256_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_256_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-256-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_256_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_256_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-256-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_256_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_256_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-256-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_256_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_256_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-256-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_CAMELLIA_256_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_camellia_256_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("CAMELLIA-256-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // ====================================================================
+ // ARIA
+ // ====================================================================
+
+ // ARIA-128
+ private static final IDetectionRule EVP_ARIA_128_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_GCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_gcm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-GCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_128_CCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_128_ccm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-128-CCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // ARIA-192
+ private static final IDetectionRule EVP_ARIA_192_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_GCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_gcm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-GCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_192_CCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_192_ccm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-192-CCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // ARIA-256
+ private static final IDetectionRule EVP_ARIA_256_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_GCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_gcm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-GCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_ARIA_256_CCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_aria_256_ccm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("ARIA-256-CCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // ====================================================================
+ // SM4 (Chinese National Standard)
+ // ====================================================================
+
+ private static final IDetectionRule EVP_SM4_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_SM4_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_SM4_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_SM4_CFB128 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_cfb128")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-CFB128"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_SM4_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_SM4_CTR =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_ctr")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-CTR"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_SM4_GCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_gcm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-GCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_SM4_CCM =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_ccm")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-CCM"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_SM4_XTS =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_sm4_xts")
+ .shouldBeDetectedAs(new ValueActionFactory<>("SM4-XTS"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // ====================================================================
+ // DES / 3DES
+ // ====================================================================
+
+ private static final IDetectionRule EVP_DES_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DES-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_DES_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DES-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_DES_EDE3_CBC =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_ede3_cbc")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DESede3-CBC"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // Single DES additional modes
+ private static final IDetectionRule EVP_DES_CFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_cfb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DES-CFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_DES_CFB1 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_cfb1")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DES-CFB1"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_DES_CFB8 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_cfb8")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DES-CFB8"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_DES_CFB64 =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_cfb64")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DES-CFB64"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_DES_OFB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_ofb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DES-OFB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ // 3DES EDE (2-key)
+ private static final IDetectionRule EVP_DES_EDE =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_ede")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DESede"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule EVP_DES_EDE_ECB =
+ new DetectionRuleBuilder()
+ .createDetectionRule()
+ .forObjectTypes("*")
+ .forMethods("EVP_des_ede_ecb")
+ .shouldBeDetectedAs(new ValueActionFactory<>("DESede-ECB"))
+ .withoutParameters()
+ .buildForContext(new CipherContext())
+ .inBundle(() -> BUNDLE)
+ .withoutDependingDetectionRules();
+
+ private static final IDetectionRule