Merge pull request #115 from Harry-Ramsey/tf-psa-crypto-doxygen

TF-PSA-Crypto Doxygen Adaptations
This commit is contained in:
Ronald Cron
2025-02-11 18:10:20 +01:00
committed by GitHub
3 changed files with 63 additions and 18 deletions
+40 -9
View File
@@ -12,17 +12,48 @@
set -eu
CONFIG_H='include/mbedtls/mbedtls_config.h'
. $(dirname "$0")/project_detection.sh
if [ -r $CONFIG_H ]; then :; else
echo "$CONFIG_H not found" >&2
exit 1
if in_mbedtls_repo; then
CONFIG_H='include/mbedtls/mbedtls_config.h'
if [ -r $CONFIG_H ]; then :; else
echo "$CONFIG_H not found" >&2
fi
if ! in_3_6_branch; then
CRYPTO_CONFIG_H='tf-psa-crypto/include/psa/crypto_config.h'
fi
fi
CONFIG_BAK=${CONFIG_H}.bak
cp -p $CONFIG_H $CONFIG_BAK
if in_tf_psa_crypto_repo; then
CRYPTO_CONFIG_H='include/psa/crypto_config.h'
fi
scripts/config.py realfull
make apidoc
if in_tf_psa_crypto_repo || (in_mbedtls_repo && ! in_3_6_branch); then
if [ -r $CRYPTO_CONFIG_H ]; then :; else
echo "$CRYPTO_CONFIG_H not found" >&2
exit 1
fi
CRYPTO_CONFIG_BAK=${CRYPTO_CONFIG_H}.bak
cp -p $CRYPTO_CONFIG_H $CRYPTO_CONFIG_BAK
fi
mv $CONFIG_BAK $CONFIG_H
if in_mbedtls_repo; then
CONFIG_BAK=${CONFIG_H}.bak
cp -p $CONFIG_H $CONFIG_BAK
scripts/config.py realfull
make apidoc
mv $CONFIG_BAK $CONFIG_H
elif in_tf_psa_crypto_repo; then
scripts/config.py realfull
TF_PSA_CRYPTO_ROOT_DIR=$PWD
rm -rf doxygen/build-apidoc-full
mkdir doxygen/build-apidoc-full
cd doxygen/build-apidoc-full
cmake -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON $TF_PSA_CRYPTO_ROOT_DIR
make tfpsacrypto-apidoc
cd $TF_PSA_CRYPTO_ROOT_DIR
fi
if in_tf_psa_crypto_repo || (in_mbedtls_repo && ! in_3_6_branch); then
mv $CRYPTO_CONFIG_BAK $CRYPTO_CONFIG_H
fi
+15 -6
View File
@@ -16,7 +16,10 @@ use strict;
use File::Basename;
# C/header files in the following directories will be checked
my @directories = qw(include/mbedtls library doxygen/input);
my @mbedtls_directories = qw(include/mbedtls library doxygen/input);
my @tf_psa_crypto_directories = qw(include/psa include/tf-psa-crypto
drivers/builtin/include/mbedtls
drivers/builtin/src core doxygen/input);
# very naive pattern to find directives:
# everything with a backslach except '\0' and backslash at EOL
@@ -53,13 +56,19 @@ sub check_dir {
}
}
open my $project_file, "scripts/project_name.txt" or die "This script must be run from Mbed TLS or TF-PSA-Crypto root directory";
my $project = <$project_file>;
chomp($project);
my @directories;
if ($project eq "TF-PSA-Crypto") {
@directories = @tf_psa_crypto_directories
} elsif ($project eq "Mbed TLS") {
@directories = @mbedtls_directories
}
# Check that the script is being run from the project's root directory.
for my $dir (@directories) {
if (! -d $dir) {
die "This script must be run from the Mbed TLS root directory";
} else {
check_dir($dir)
}
check_dir($dir)
}
exit $exit_code;
+8 -3
View File
@@ -8,8 +8,10 @@
# Abort on errors (and uninitialised variables)
set -eu
if [ -d library -a -d include -a -d tests ]; then :; else
echo "Must be run from Mbed TLS root" >&2
. $(dirname "$0")/project_detection.sh
if in_mbedtls_repo || in_tf_psa_crypto_repo; then :; else
echo "Must be run from Mbed TLS root or TF-PSA-Crypto root" >&2
exit 1
fi
@@ -28,5 +30,8 @@ if grep -E "(warning|error):" doc.filtered; then
exit 1;
fi
make apidoc_clean
if in_mbedtls_repo; then
make apidoc_clean
fi
rm -f doc.out doc.err doc.filtered