mirror of
https://github.com/yuzu-mirror/mbedtls.git
synced 2026-04-20 22:05:15 +00:00
Merge remote-tracking branch 'origin/development' into support_cipher_encrypt_only
This commit is contained in:
commit
690ee81533
594 changed files with 7555 additions and 10243 deletions
2
programs/.gitignore
vendored
2
programs/.gitignore
vendored
|
|
@ -38,6 +38,7 @@ psa/crypto_examples
|
|||
psa/hmac_demo
|
||||
psa/key_ladder_demo
|
||||
psa/psa_constant_names
|
||||
psa/psa_hash
|
||||
random/gen_entropy
|
||||
random/gen_random_ctr_drbg
|
||||
ssl/dtls_client
|
||||
|
|
@ -56,6 +57,7 @@ test/cpp_dummy_build
|
|||
test/cpp_dummy_build.cpp
|
||||
test/dlopen
|
||||
test/ecp-bench
|
||||
test/metatest
|
||||
test/query_compile_time_config
|
||||
test/query_included_headers
|
||||
test/selftest
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ APPS = \
|
|||
ssl/ssl_server \
|
||||
ssl/ssl_server2 \
|
||||
test/benchmark \
|
||||
test/metatest \
|
||||
test/query_compile_time_config \
|
||||
test/query_included_headers \
|
||||
test/selftest \
|
||||
|
|
@ -413,6 +414,10 @@ test/dlopen$(EXEXT): test/dlopen.c $(DEP)
|
|||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/dlopen.c $(LDFLAGS) $(DLOPEN_LDFLAGS) -o $@
|
||||
endif
|
||||
|
||||
test/metatest$(EXEXT): test/metatest.c $(DEP)
|
||||
echo " CC test/metatest.c"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -I ../library test/metatest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
test/query_config.o: test/query_config.c test/query_config.h $(DEP)
|
||||
echo " CC test/query_config.c"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c test/query_config.c -o $@
|
||||
|
|
|
|||
|
|
@ -3,19 +3,7 @@
|
|||
* security.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* Enable definition of fileno() even when compiling with -std=c99. Must be
|
||||
|
|
|
|||
|
|
@ -25,19 +25,7 @@
|
|||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* First include Mbed TLS headers to get the Mbed TLS configuration and
|
||||
|
|
|
|||
137
programs/demo_common.sh
Normal file
137
programs/demo_common.sh
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
## Common shell functions used by demo scripts programs/*/*.sh.
|
||||
|
||||
## How to write a demo script
|
||||
## ==========================
|
||||
##
|
||||
## Include this file near the top of each demo script:
|
||||
## . "${0%/*}/../demo_common.sh"
|
||||
##
|
||||
## Start with a "msg" call that explains the purpose of the script.
|
||||
## Then call the "depends_on" function to ensure that all config
|
||||
## dependencies are met.
|
||||
##
|
||||
## As the last thing in the script, call the cleanup function.
|
||||
##
|
||||
## You can use the functions and variables described below.
|
||||
|
||||
set -e -u
|
||||
|
||||
## $root_dir is the root directory of the Mbed TLS source tree.
|
||||
root_dir="${0%/*}"
|
||||
# Find a nice path to the root directory, avoiding unnecessary "../".
|
||||
# The code supports demo scripts nested up to 4 levels deep.
|
||||
# The code works no matter where the demo script is relative to the current
|
||||
# directory, even if it is called with a relative path.
|
||||
n=4 # limit the search depth
|
||||
while ! [ -d "$root_dir/programs" ] || ! [ -d "$root_dir/library" ]; do
|
||||
if [ $n -eq 0 ]; then
|
||||
echo >&2 "This doesn't seem to be an Mbed TLS source tree."
|
||||
exit 125
|
||||
fi
|
||||
n=$((n - 1))
|
||||
case $root_dir in
|
||||
.) root_dir="..";;
|
||||
..|?*/..) root_dir="$root_dir/..";;
|
||||
?*/*) root_dir="${root_dir%/*}";;
|
||||
/*) root_dir="/";;
|
||||
*) root_dir=".";;
|
||||
esac
|
||||
done
|
||||
|
||||
## $programs_dir is the directory containing the sample programs.
|
||||
# Assume an in-tree build.
|
||||
programs_dir="$root_dir/programs"
|
||||
|
||||
## msg LINE...
|
||||
## msg <TEXT_ORIGIN
|
||||
## Display an informational message.
|
||||
msg () {
|
||||
if [ $# -eq 0 ]; then
|
||||
sed 's/^/# /'
|
||||
else
|
||||
for x in "$@"; do
|
||||
echo "# $x"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
## run "Message" COMMAND ARGUMENT...
|
||||
## Display the message, then run COMMAND with the specified arguments.
|
||||
run () {
|
||||
echo
|
||||
echo "# $1"
|
||||
shift
|
||||
echo "+ $*"
|
||||
"$@"
|
||||
}
|
||||
|
||||
## Like '!', but stop on failure with 'set -e'
|
||||
not () {
|
||||
if "$@"; then false; fi
|
||||
}
|
||||
|
||||
## run_bad "Message" COMMAND ARGUMENT...
|
||||
## Like run, but the command is expected to fail.
|
||||
run_bad () {
|
||||
echo
|
||||
echo "$1 This must fail."
|
||||
shift
|
||||
echo "+ ! $*"
|
||||
not "$@"
|
||||
}
|
||||
|
||||
## config_has SYMBOL...
|
||||
## Succeeds if the library configuration has all SYMBOLs set.
|
||||
config_has () {
|
||||
for x in "$@"; do
|
||||
"$programs_dir/test/query_compile_time_config" "$x"
|
||||
done
|
||||
}
|
||||
|
||||
## depends_on SYMBOL...
|
||||
## Exit if the library configuration does not have all SYMBOLs set.
|
||||
depends_on () {
|
||||
m=
|
||||
for x in "$@"; do
|
||||
if ! config_has "$x"; then
|
||||
m="$m $x"
|
||||
fi
|
||||
done
|
||||
if [ -n "$m" ]; then
|
||||
cat >&2 <<EOF
|
||||
$0: this demo requires the following
|
||||
configuration options to be enabled at compile time:
|
||||
$m
|
||||
EOF
|
||||
# Exit with a success status so that this counts as a pass for run_demos.py.
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
## Add the names of files to clean up to this whitespace-separated variable.
|
||||
## The file names must not contain whitespace characters.
|
||||
files_to_clean=
|
||||
|
||||
## Call this function at the end of each script.
|
||||
## It is called automatically if the script is killed by a signal.
|
||||
cleanup () {
|
||||
rm -f -- $files_to_clean
|
||||
}
|
||||
|
||||
|
||||
|
||||
################################################################
|
||||
## End of the public interfaces. Code beyond this point is not
|
||||
## meant to be called directly from a demo script.
|
||||
|
||||
trap 'cleanup; trap - HUP; kill -HUP $$' HUP
|
||||
trap 'cleanup; trap - INT; kill -INT $$' INT
|
||||
trap 'cleanup; trap - TERM; kill -TERM $$' TERM
|
||||
|
||||
if config_has MBEDTLS_ENTROPY_NV_SEED; then
|
||||
# Create a seedfile that's sufficiently long in all library configurations.
|
||||
# This is necessary for programs that use randomness.
|
||||
# Assume that the name of the seedfile is the default name.
|
||||
files_to_clean="$files_to_clean seedfile"
|
||||
dd if=/dev/urandom of=seedfile ibs=64 obs=64 count=1
|
||||
fi
|
||||
|
|
@ -2,19 +2,7 @@
|
|||
* generic message digest layer demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Classic "Hello, world" demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -20,19 +20,7 @@
|
|||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* First include Mbed TLS headers to get the Mbed TLS configuration and
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Diffie-Hellman-Merkle key exchange (client side)
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Diffie-Hellman-Merkle key exchange (prime generation)
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Diffie-Hellman-Merkle key exchange (server side)
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Example ECDHE with Curve25519 program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Example ECDSA program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Key generation application
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Key reading application
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Key writing application
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Simple MPI demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Public key-based simple decryption program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* RSA simple data encryption program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Public key-based signature creation program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Public key-based signature verification program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* RSA simple decryption program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* RSA simple data encryption program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Example RSA key generation program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* RSA/SHA-256 signature creation program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* RSASSA-PSS/SHA-256 signature creation program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* RSA/SHA-256 signature verification program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* RSASSA-PSS/SHA-256 signature verification program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -26,19 +26,7 @@
|
|||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* First include Mbed TLS headers to get the Mbed TLS configuration and
|
||||
|
|
|
|||
|
|
@ -1,18 +1,6 @@
|
|||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "psa/crypto.h"
|
||||
|
|
|
|||
|
|
@ -20,19 +20,7 @@
|
|||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* First include Mbed TLS headers to get the Mbed TLS configuration and
|
||||
|
|
|
|||
|
|
@ -32,19 +32,7 @@
|
|||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* First include Mbed TLS headers to get the Mbed TLS configuration and
|
||||
|
|
|
|||
|
|
@ -1,50 +1,19 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed 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.
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
set -e -u
|
||||
. "${0%/*}/../demo_common.sh"
|
||||
|
||||
program_name="key_ladder_demo"
|
||||
program="${0%/*}/$program_name"
|
||||
files_to_clean=
|
||||
msg <<'EOF'
|
||||
This script demonstrates the use of the PSA cryptography interface to
|
||||
create a master key, derive a key from it and use that derived key to
|
||||
wrap some data using an AEAD algorithm.
|
||||
EOF
|
||||
|
||||
if [ ! -e "$program" ]; then
|
||||
# Look for programs in the current directory and the directories above it
|
||||
for dir in "." ".." "../.."; do
|
||||
program="$dir/programs/psa/$program_name"
|
||||
if [ -e "$program" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ! -e "$program" ]; then
|
||||
echo "Could not find $program_name executable"
|
||||
depends_on MBEDTLS_SHA256_C MBEDTLS_MD_C MBEDTLS_AES_C MBEDTLS_CCM_C MBEDTLS_PSA_CRYPTO_C MBEDTLS_FS_IO
|
||||
|
||||
echo "If building out-of-tree, this script must be run" \
|
||||
"from the project build directory."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
run () {
|
||||
echo
|
||||
echo "# $1"
|
||||
shift
|
||||
echo "+ $*"
|
||||
"$@"
|
||||
}
|
||||
program="${0%/*}"/key_ladder_demo
|
||||
|
||||
if [ -e master.key ]; then
|
||||
echo "# Reusing the existing master.key file."
|
||||
|
|
@ -68,7 +37,7 @@ run "Compare the unwrapped data with the original input." \
|
|||
cmp input.txt hello_world.txt
|
||||
|
||||
files_to_clean="$files_to_clean hellow_orld.txt"
|
||||
! run "Derive a different key and attempt to unwrap the data. This must fail." \
|
||||
run_bad "Derive a different key and attempt to unwrap the data." \
|
||||
"$program" unwrap master=master.key input=hello_world.wrap output=hellow_orld.txt label=hellow label=orld
|
||||
|
||||
files_to_clean="$files_to_clean hello.key"
|
||||
|
|
@ -79,5 +48,4 @@ run "Check that we get the same key by unwrapping data made by the other key." \
|
|||
"$program" unwrap master=hello.key label=world \
|
||||
input=hello_world.wrap output=hello_world.txt
|
||||
|
||||
# Cleanup
|
||||
rm -f $files_to_clean
|
||||
cleanup
|
||||
|
|
|
|||
|
|
@ -1,18 +1,6 @@
|
|||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
|
|
|||
|
|
@ -9,19 +9,7 @@
|
|||
*
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "psa/crypto.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* \brief Use and generate multiple entropies calls into a file
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* \brief Use and generate random data into a file via the CTR_DBRG based on AES
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Simple DTLS client demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Simple DTLS server demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -3,19 +3,7 @@
|
|||
* (meant to be used with config-suite-b.h or config-ccm-psk-tls1_2.h)
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* SSL client demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* SSL client with certificate authentication
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
||||
|
|
@ -469,7 +457,7 @@ int main(void)
|
|||
" otherwise. The expansion of the macro\n" \
|
||||
" is printed if it is defined\n" \
|
||||
USAGE_SERIALIZATION \
|
||||
" acceptable ciphersuite names:\n"
|
||||
"\n"
|
||||
|
||||
/*
|
||||
* global options
|
||||
|
|
@ -705,7 +693,7 @@ static int ssl_save_session_serialize(mbedtls_ssl_context *ssl,
|
|||
}
|
||||
|
||||
/* get size of the buffer needed */
|
||||
mbedtls_ssl_session_save(&exported_session, NULL, 0, session_data_len);
|
||||
(void) mbedtls_ssl_session_save(&exported_session, NULL, 0, session_data_len);
|
||||
*session_data = mbedtls_calloc(1, *session_data_len);
|
||||
if (*session_data == NULL) {
|
||||
mbedtls_printf(" failed\n ! alloc %u bytes for session data\n",
|
||||
|
|
@ -864,31 +852,6 @@ int main(int argc, char *argv[])
|
|||
mbedtls_test_enable_insecure_external_rng();
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
|
||||
|
||||
if (argc < 2) {
|
||||
usage:
|
||||
if (ret == 0) {
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
mbedtls_printf(USAGE1);
|
||||
mbedtls_printf(USAGE2);
|
||||
mbedtls_printf(USAGE3);
|
||||
mbedtls_printf(USAGE4);
|
||||
|
||||
list = mbedtls_ssl_list_ciphersuites();
|
||||
while (*list) {
|
||||
mbedtls_printf(" %-42s", mbedtls_ssl_get_ciphersuite_name(*list));
|
||||
list++;
|
||||
if (!*list) {
|
||||
break;
|
||||
}
|
||||
mbedtls_printf(" %s\n", mbedtls_ssl_get_ciphersuite_name(*list));
|
||||
list++;
|
||||
}
|
||||
mbedtls_printf("\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
opt.server_name = DFL_SERVER_NAME;
|
||||
opt.server_addr = DFL_SERVER_ADDR;
|
||||
opt.server_port = DFL_SERVER_PORT;
|
||||
|
|
@ -973,9 +936,54 @@ usage:
|
|||
opt.key_opaque_alg1 = DFL_KEY_OPAQUE_ALG;
|
||||
opt.key_opaque_alg2 = DFL_KEY_OPAQUE_ALG;
|
||||
|
||||
p = q = NULL;
|
||||
if (argc < 1) {
|
||||
usage:
|
||||
if (p != NULL && q != NULL) {
|
||||
printf("unrecognized value for '%s': '%s'\n", p, q);
|
||||
} else if (p != NULL && q == NULL) {
|
||||
printf("unrecognized param: '%s'\n", p);
|
||||
}
|
||||
|
||||
mbedtls_printf("usage: ssl_client2 [param=value] [...]\n");
|
||||
mbedtls_printf(" ssl_client2 help[_theme]\n");
|
||||
mbedtls_printf("'help' lists acceptable 'param' and 'value'\n");
|
||||
mbedtls_printf("'help_ciphersuites' lists available ciphersuites\n");
|
||||
mbedtls_printf("\n");
|
||||
|
||||
if (ret == 0) {
|
||||
ret = 1;
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
p = argv[i];
|
||||
|
||||
if (strcmp(p, "help") == 0) {
|
||||
mbedtls_printf(USAGE1);
|
||||
mbedtls_printf(USAGE2);
|
||||
mbedtls_printf(USAGE3);
|
||||
mbedtls_printf(USAGE4);
|
||||
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
if (strcmp(p, "help_ciphersuites") == 0) {
|
||||
mbedtls_printf(" acceptable ciphersuite names:\n");
|
||||
for (list = mbedtls_ssl_list_ciphersuites();
|
||||
*list != 0;
|
||||
list++) {
|
||||
mbedtls_printf(" %s\n", mbedtls_ssl_get_ciphersuite_name(*list));
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((q = strchr(p, '=')) == NULL) {
|
||||
mbedtls_printf("param requires a value: '%s'\n", p);
|
||||
p = NULL; // avoid "unrecnognized param" message
|
||||
goto usage;
|
||||
}
|
||||
*q++ = '\0';
|
||||
|
|
@ -1372,9 +1380,13 @@ usage:
|
|||
goto usage;
|
||||
}
|
||||
} else {
|
||||
/* This signals that the problem is with p not q */
|
||||
q = NULL;
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
/* This signals that any further errors are not with a single option */
|
||||
p = q = NULL;
|
||||
|
||||
if (opt.nss_keylog != 0 && opt.eap_tls != 0) {
|
||||
mbedtls_printf("Error: eap_tls and nss_keylog options cannot be used together.\n");
|
||||
|
|
@ -1959,7 +1971,7 @@ usage:
|
|||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_EARLY_DATA)
|
||||
mbedtls_ssl_tls13_conf_early_data(&conf, opt.early_data);
|
||||
mbedtls_ssl_conf_early_data(&conf, opt.early_data);
|
||||
#endif /* MBEDTLS_SSL_EARLY_DATA */
|
||||
|
||||
if ((ret = mbedtls_ssl_setup(&ssl, &conf)) != 0) {
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Mbed TLS SSL context deserializer from base64 code
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
||||
|
|
@ -559,7 +547,6 @@ void print_deserialized_ssl_session(const uint8_t *ssl, uint32_t len,
|
|||
if (ciphersuite_info == NULL) {
|
||||
printf_err("Cannot find ciphersuite info\n");
|
||||
} else {
|
||||
const mbedtls_cipher_info_t *cipher_info;
|
||||
#if defined(MBEDTLS_MD_C)
|
||||
const mbedtls_md_info_t *md_info;
|
||||
#endif
|
||||
|
|
@ -567,12 +554,18 @@ void print_deserialized_ssl_session(const uint8_t *ssl, uint32_t len,
|
|||
printf("\tciphersuite : %s\n", ciphersuite_info->name);
|
||||
printf("\tcipher flags : 0x%02X\n", ciphersuite_info->flags);
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_C)
|
||||
const mbedtls_cipher_info_t *cipher_info;
|
||||
cipher_info = mbedtls_cipher_info_from_type(ciphersuite_info->cipher);
|
||||
if (cipher_info == NULL) {
|
||||
printf_err("Cannot find cipher info\n");
|
||||
} else {
|
||||
printf("\tcipher : %s\n", cipher_info->name);
|
||||
}
|
||||
#else /* MBEDTLS_CIPHER_C */
|
||||
printf("\tcipher type : %d\n", ciphersuite_info->cipher);
|
||||
#endif /* MBEDTLS_CIPHER_C */
|
||||
|
||||
#if defined(MBEDTLS_MD_C)
|
||||
md_info = mbedtls_md_info_from_type(ciphersuite_info->mac);
|
||||
if (md_info == NULL) {
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* SSL server demonstration program using fork() for handling multiple clients
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* SSL client for SMTP servers
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* Enable definition of gethostname() even when compiling with -std=c99. Must
|
||||
|
|
|
|||
|
|
@ -3,19 +3,7 @@
|
|||
* clients.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* SSL server demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* SSL client with options
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
||||
|
|
@ -283,6 +271,7 @@ int main(void)
|
|||
#else
|
||||
#define USAGE_PSK ""
|
||||
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
|
||||
#define USAGE_CA_CALLBACK \
|
||||
" ca_callback=%%d default: 0 (disabled)\n" \
|
||||
|
|
@ -290,13 +279,14 @@ int main(void)
|
|||
#else
|
||||
#define USAGE_CA_CALLBACK ""
|
||||
#endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
|
||||
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_TICKET_C)
|
||||
#define USAGE_TICKETS \
|
||||
" tickets=%%d default: 1 (enabled)\n" \
|
||||
" ticket_rotate=%%d default: 0 (disabled)\n" \
|
||||
" ticket_timeout=%%d default: 86400 (one day)\n" \
|
||||
" ticket_aead=%%s default: \"AES-256-GCM\"\n"
|
||||
#else
|
||||
#else /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_TICKET_C */
|
||||
#define USAGE_TICKETS ""
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_TICKET_C */
|
||||
|
||||
|
|
@ -590,7 +580,7 @@ int main(void)
|
|||
" otherwise. The expansion of the macro\n" \
|
||||
" is printed if it is defined\n" \
|
||||
USAGE_SERIALIZATION \
|
||||
" acceptable ciphersuite names:\n"
|
||||
"\n"
|
||||
|
||||
#define PUT_UINT64_BE(out_be, in_le, i) \
|
||||
{ \
|
||||
|
|
@ -1429,22 +1419,29 @@ int dummy_ticket_parse(void *p_ticket, mbedtls_ssl_session *session,
|
|||
return MBEDTLS_ERR_SSL_INVALID_MAC;
|
||||
case 2:
|
||||
return MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED;
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
case 3:
|
||||
session->start = mbedtls_time(NULL) + 10;
|
||||
/* Creation time in the future. */
|
||||
session->ticket_creation_time = mbedtls_ms_time() + 1000;
|
||||
break;
|
||||
case 4:
|
||||
session->start = mbedtls_time(NULL) - 10 - 7 * 24 * 3600;
|
||||
/* Ticket has reached the end of lifetime. */
|
||||
session->ticket_creation_time = mbedtls_ms_time() -
|
||||
(7 * 24 * 3600 * 1000 + 1000);
|
||||
break;
|
||||
case 5:
|
||||
session->start = mbedtls_time(NULL) - 10;
|
||||
/* Ticket is valid, but client age is below the lower bound of the tolerance window. */
|
||||
session->ticket_age_add += MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE + 4 * 1000;
|
||||
/* Make sure the execution time does not affect the result */
|
||||
session->ticket_creation_time = mbedtls_ms_time();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
session->start = mbedtls_time(NULL);
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
session->ticket_age_add -= 1000;
|
||||
#endif
|
||||
/* Ticket is valid, but client age is beyond the upper bound of the tolerance window. */
|
||||
session->ticket_age_add -= MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE + 4 * 1000;
|
||||
/* Make sure the execution time does not affect the result */
|
||||
session->ticket_creation_time = mbedtls_ms_time();
|
||||
break;
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
case 7:
|
||||
session->ticket_flags = MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_NONE;
|
||||
break;
|
||||
|
|
@ -1466,6 +1463,42 @@ int dummy_ticket_parse(void *p_ticket, mbedtls_ssl_session *session,
|
|||
}
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_HAVE_TIME */
|
||||
|
||||
int parse_cipher(char *buf)
|
||||
{
|
||||
if (strcmp(buf, "AES-128-CCM")) {
|
||||
return MBEDTLS_CIPHER_AES_128_CCM;
|
||||
} else if (strcmp(buf, "AES-128-GCM")) {
|
||||
return MBEDTLS_CIPHER_AES_128_GCM;
|
||||
} else if (strcmp(buf, "AES-192-CCM")) {
|
||||
return MBEDTLS_CIPHER_AES_192_CCM;
|
||||
} else if (strcmp(buf, "AES-192-GCM")) {
|
||||
return MBEDTLS_CIPHER_AES_192_GCM;
|
||||
} else if (strcmp(buf, "AES-256-CCM")) {
|
||||
return MBEDTLS_CIPHER_AES_256_CCM;
|
||||
} else if (strcmp(buf, "ARIA-128-CCM")) {
|
||||
return MBEDTLS_CIPHER_ARIA_128_CCM;
|
||||
} else if (strcmp(buf, "ARIA-128-GCM")) {
|
||||
return MBEDTLS_CIPHER_ARIA_128_GCM;
|
||||
} else if (strcmp(buf, "ARIA-192-CCM")) {
|
||||
return MBEDTLS_CIPHER_ARIA_192_CCM;
|
||||
} else if (strcmp(buf, "ARIA-192-GCM")) {
|
||||
return MBEDTLS_CIPHER_ARIA_192_GCM;
|
||||
} else if (strcmp(buf, "ARIA-256-CCM")) {
|
||||
return MBEDTLS_CIPHER_ARIA_256_CCM;
|
||||
} else if (strcmp(buf, "ARIA-256-GCM")) {
|
||||
return MBEDTLS_CIPHER_ARIA_256_GCM;
|
||||
} else if (strcmp(buf, "CAMELLIA-128-CCM")) {
|
||||
return MBEDTLS_CIPHER_CAMELLIA_128_CCM;
|
||||
} else if (strcmp(buf, "CAMELLIA-192-CCM")) {
|
||||
return MBEDTLS_CIPHER_CAMELLIA_192_CCM;
|
||||
} else if (strcmp(buf, "CAMELLIA-256-CCM")) {
|
||||
return MBEDTLS_CIPHER_CAMELLIA_256_CCM;
|
||||
} else if (strcmp(buf, "CHACHA20-POLY1305")) {
|
||||
return MBEDTLS_CIPHER_CHACHA20_POLY1305;
|
||||
}
|
||||
return MBEDTLS_CIPHER_NONE;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0, len, written, frags, exchanges_left;
|
||||
|
|
@ -1642,31 +1675,6 @@ int main(int argc, char *argv[])
|
|||
signal(SIGINT, term_handler);
|
||||
#endif
|
||||
|
||||
if (argc < 2) {
|
||||
usage:
|
||||
if (ret == 0) {
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
mbedtls_printf(USAGE1);
|
||||
mbedtls_printf(USAGE2);
|
||||
mbedtls_printf(USAGE3);
|
||||
mbedtls_printf(USAGE4);
|
||||
|
||||
list = mbedtls_ssl_list_ciphersuites();
|
||||
while (*list) {
|
||||
mbedtls_printf(" %-42s", mbedtls_ssl_get_ciphersuite_name(*list));
|
||||
list++;
|
||||
if (!*list) {
|
||||
break;
|
||||
}
|
||||
mbedtls_printf(" %s\n", mbedtls_ssl_get_ciphersuite_name(*list));
|
||||
list++;
|
||||
}
|
||||
mbedtls_printf("\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
opt.buffer_size = DFL_IO_BUF_LEN;
|
||||
opt.server_addr = DFL_SERVER_ADDR;
|
||||
opt.server_port = DFL_SERVER_PORT;
|
||||
|
|
@ -1765,9 +1773,54 @@ usage:
|
|||
opt.key2_opaque_alg1 = DFL_KEY_OPAQUE_ALG;
|
||||
opt.key2_opaque_alg2 = DFL_KEY_OPAQUE_ALG;
|
||||
|
||||
p = q = NULL;
|
||||
if (argc < 1) {
|
||||
usage:
|
||||
if (p != NULL && q != NULL) {
|
||||
printf("unrecognized value for '%s': '%s'\n", p, q);
|
||||
} else if (p != NULL && q == NULL) {
|
||||
printf("unrecognized param: '%s'\n", p);
|
||||
}
|
||||
|
||||
mbedtls_printf("usage: ssl_client2 [param=value] [...]\n");
|
||||
mbedtls_printf(" ssl_client2 help[_theme]\n");
|
||||
mbedtls_printf("'help' lists acceptable 'param' and 'value'\n");
|
||||
mbedtls_printf("'help_ciphersuites' lists available ciphersuites\n");
|
||||
mbedtls_printf("\n");
|
||||
|
||||
if (ret == 0) {
|
||||
ret = 1;
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
p = argv[i];
|
||||
|
||||
if (strcmp(p, "help") == 0) {
|
||||
mbedtls_printf(USAGE1);
|
||||
mbedtls_printf(USAGE2);
|
||||
mbedtls_printf(USAGE3);
|
||||
mbedtls_printf(USAGE4);
|
||||
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
if (strcmp(p, "help_ciphersuites") == 0) {
|
||||
mbedtls_printf(" acceptable ciphersuite names:\n");
|
||||
for (list = mbedtls_ssl_list_ciphersuites();
|
||||
*list != 0;
|
||||
list++) {
|
||||
mbedtls_printf(" %s\n", mbedtls_ssl_get_ciphersuite_name(*list));
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ((q = strchr(p, '=')) == NULL) {
|
||||
mbedtls_printf("param requires a value: '%s'\n", p);
|
||||
p = NULL; // avoid "unrecnognized param" message
|
||||
goto usage;
|
||||
}
|
||||
*q++ = '\0';
|
||||
|
|
@ -2127,12 +2180,11 @@ usage:
|
|||
goto usage;
|
||||
}
|
||||
} else if (strcmp(p, "ticket_aead") == 0) {
|
||||
const mbedtls_cipher_info_t *ci = mbedtls_cipher_info_from_string(q);
|
||||
opt.ticket_aead = parse_cipher(q);
|
||||
|
||||
if (ci == NULL) {
|
||||
if (opt.ticket_aead == MBEDTLS_CIPHER_NONE) {
|
||||
goto usage;
|
||||
}
|
||||
opt.ticket_aead = mbedtls_cipher_info_get_type(ci);
|
||||
} else if (strcmp(p, "cache_max") == 0) {
|
||||
opt.cache_max = atoi(q);
|
||||
if (opt.cache_max < 0) {
|
||||
|
|
@ -2232,9 +2284,13 @@ usage:
|
|||
goto usage;
|
||||
}
|
||||
} else {
|
||||
/* This signals that the problem is with p not q */
|
||||
q = NULL;
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
/* This signals that any further erorrs are not with a single option */
|
||||
p = q = NULL;
|
||||
|
||||
if (opt.nss_keylog != 0 && opt.eap_tls != 0) {
|
||||
mbedtls_printf("Error: eap_tls and nss_keylog options cannot be used together.\n");
|
||||
|
|
@ -2751,9 +2807,9 @@ usage:
|
|||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_EARLY_DATA)
|
||||
mbedtls_ssl_tls13_conf_early_data(&conf, tls13_early_data_enabled);
|
||||
mbedtls_ssl_conf_early_data(&conf, tls13_early_data_enabled);
|
||||
if (tls13_early_data_enabled == MBEDTLS_SSL_EARLY_DATA_ENABLED) {
|
||||
mbedtls_ssl_tls13_conf_max_early_data_size(
|
||||
mbedtls_ssl_conf_max_early_data_size(
|
||||
&conf, opt.max_early_data_size);
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_EARLY_DATA */
|
||||
|
|
|
|||
|
|
@ -9,19 +9,7 @@
|
|||
* This file is meant to be #include'd and cannot be compiled separately.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
void eap_tls_key_derivation(void *p_expkey,
|
||||
|
|
|
|||
|
|
@ -5,19 +5,7 @@
|
|||
* that cannot be compiled separately in "ssl_test_common_source.c".
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Common code for SSL test programs
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ set(libs
|
|||
)
|
||||
|
||||
set(executables_libs
|
||||
metatest
|
||||
query_included_headers
|
||||
selftest
|
||||
udp_proxy
|
||||
|
|
@ -72,6 +73,7 @@ foreach(exe IN LISTS executables_libs executables_mbedcrypto)
|
|||
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>
|
||||
${extra_sources})
|
||||
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
|
||||
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../library)
|
||||
if(exe STREQUAL "query_compile_time_config")
|
||||
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Benchmark demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Simple program to test that Mbed TLS builds correctly as a CMake package.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -3,19 +3,7 @@
|
|||
* package.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -3,19 +3,7 @@
|
|||
* work correctly.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Test dynamic loading of libmbed*
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -4,48 +4,23 @@
|
|||
# This is only expected to work when Mbed TLS is built as a shared library.
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed 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.
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
set -e -u
|
||||
. "${0%/*}/../demo_common.sh"
|
||||
|
||||
program_name="dlopen"
|
||||
program_dir="${0%/*}"
|
||||
program="$program_dir/$program_name"
|
||||
msg "Test the dynamic loading of libmbed*"
|
||||
|
||||
program="$programs_dir/test/dlopen"
|
||||
library_dir="$root_dir/library"
|
||||
|
||||
# Skip this test if we don't have a shared library build. Detect this
|
||||
# through the absence of the demo program.
|
||||
if [ ! -e "$program" ]; then
|
||||
# Look for programs in the current directory and the directories above it
|
||||
for dir in "." ".." "../.."; do
|
||||
program_dir="$dir/programs/test"
|
||||
program="$program_dir/$program_name"
|
||||
if [ -e "$program" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ! -e "$program" ]; then
|
||||
echo "Could not find $program_name program"
|
||||
|
||||
echo "Make sure that Mbed TLS is built as a shared library." \
|
||||
"If building out-of-tree, this script must be run" \
|
||||
"from the project build directory."
|
||||
exit 1
|
||||
fi
|
||||
msg "$0: this demo requires a shared library build."
|
||||
# Exit with a success status so that this counts as a pass for run_demos.py.
|
||||
exit
|
||||
fi
|
||||
|
||||
top_dir="$program_dir/../.."
|
||||
library_dir="$top_dir/library"
|
||||
|
||||
# ELF-based Unix-like (Linux, *BSD, Solaris, ...)
|
||||
if [ -n "${LD_LIBRARY_PATH-}" ]; then
|
||||
LD_LIBRARY_PATH="$library_dir:$LD_LIBRARY_PATH"
|
||||
|
|
@ -62,6 +37,6 @@ else
|
|||
fi
|
||||
export DYLD_LIBRARY_PATH
|
||||
|
||||
echo "Running dynamic loading test program: $program"
|
||||
echo "Loading libraries from: $library_dir"
|
||||
msg "Running dynamic loading test program: $program"
|
||||
msg "Loading libraries from: $library_dir"
|
||||
"$program"
|
||||
|
|
|
|||
|
|
@ -14,19 +14,7 @@ EOF
|
|||
fi
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed 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.
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
set -e
|
||||
|
||||
|
|
@ -41,19 +29,8 @@ print_cpp () {
|
|||
* can be included and built with a C++ compiler.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
351
programs/test/metatest.c
Normal file
351
programs/test/metatest.c
Normal file
|
|
@ -0,0 +1,351 @@
|
|||
/** \file metatest.c
|
||||
*
|
||||
* \brief Test features of the test framework.
|
||||
*
|
||||
* When you run this program, it runs a single "meta-test". A meta-test
|
||||
* performs an operation which should be caught as a failure by our
|
||||
* test framework. The meta-test passes if this program calls `exit` with
|
||||
* a nonzero status, or aborts, or is terminated by a signal, or if the
|
||||
* framework running the program considers the run an error (this happens
|
||||
* with Valgrind for a memory leak). The non-success of the meta-test
|
||||
* program means that the test failure has been caught correctly.
|
||||
*
|
||||
* Some failures are purely functional: the logic of the code causes the
|
||||
* test result to be set to FAIL. Other failures come from extra
|
||||
* instrumentation which is not present in a normal build; for example,
|
||||
* Asan or Valgrind to detect memory leaks. This is reflected by the
|
||||
* "platform" associated with each meta-test.
|
||||
*
|
||||
* Use the companion script `tests/scripts/run-metatests.sh` to run all
|
||||
* the meta-tests for a given platform and validate that they trigger a
|
||||
* detected failure as expected.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
||||
|
||||
#include <mbedtls/platform.h>
|
||||
#include <mbedtls/platform_util.h>
|
||||
#include "test/helpers.h"
|
||||
#include "test/macros.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
#include <mbedtls/threading.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* This is an external variable, so the compiler doesn't know that we're never
|
||||
* changing its value.
|
||||
*/
|
||||
volatile int false_but_the_compiler_does_not_know = 0;
|
||||
|
||||
/* Set n bytes at the address p to all-bits-zero, in such a way that
|
||||
* the compiler should not know that p is all-bits-zero. */
|
||||
static void set_to_zero_but_the_compiler_does_not_know(volatile void *p, size_t n)
|
||||
{
|
||||
memset((void *) p, false_but_the_compiler_does_not_know, n);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
/* Test framework features */
|
||||
/****************************************************************/
|
||||
|
||||
void meta_test_fail(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
mbedtls_test_fail("Forced test failure", __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
/* Platform features */
|
||||
/****************************************************************/
|
||||
|
||||
void null_pointer_dereference(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
volatile char *volatile p;
|
||||
set_to_zero_but_the_compiler_does_not_know(&p, sizeof(p));
|
||||
/* Undefined behavior (read from null data pointer) */
|
||||
mbedtls_printf("%p -> %u\n", p, (unsigned) *p);
|
||||
}
|
||||
|
||||
void null_pointer_call(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
unsigned(*volatile p)(void);
|
||||
set_to_zero_but_the_compiler_does_not_know(&p, sizeof(p));
|
||||
/* Undefined behavior (execute null function pointer) */
|
||||
/* The pointer representation may be truncated, but we don't care:
|
||||
* the only point of printing it is to have some use of the pointer
|
||||
* to dissuade the compiler from optimizing it away. */
|
||||
mbedtls_printf("%lx() -> %u\n", (unsigned long) (uintptr_t) p, p());
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
/* Memory */
|
||||
/****************************************************************/
|
||||
|
||||
void read_after_free(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
volatile char *p = mbedtls_calloc(1, 1);
|
||||
*p = 'a';
|
||||
mbedtls_free((void *) p);
|
||||
/* Undefined behavior (read after free) */
|
||||
mbedtls_printf("%u\n", (unsigned) *p);
|
||||
}
|
||||
|
||||
void double_free(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
volatile char *p = mbedtls_calloc(1, 1);
|
||||
*p = 'a';
|
||||
mbedtls_free((void *) p);
|
||||
/* Undefined behavior (double free) */
|
||||
mbedtls_free((void *) p);
|
||||
}
|
||||
|
||||
void read_uninitialized_stack(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
char buf[1];
|
||||
if (false_but_the_compiler_does_not_know) {
|
||||
buf[0] = '!';
|
||||
}
|
||||
char *volatile p = buf;
|
||||
if (*p != 0) {
|
||||
/* Unspecified result (read from uninitialized memory) */
|
||||
mbedtls_printf("%u\n", (unsigned) *p);
|
||||
}
|
||||
}
|
||||
|
||||
void memory_leak(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
volatile char *p = mbedtls_calloc(1, 1);
|
||||
mbedtls_printf("%u\n", (unsigned) *p);
|
||||
/* Leak of a heap object */
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
/* Threading */
|
||||
/****************************************************************/
|
||||
|
||||
void mutex_lock_not_initialized(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
mbedtls_threading_mutex_t mutex;
|
||||
memset(&mutex, 0, sizeof(mutex));
|
||||
/* This mutex usage error is detected by our test framework's mutex usage
|
||||
* verification framework. See tests/src/threading_helpers.c. Other
|
||||
* threading implementations (e.g. pthread without our instrumentation)
|
||||
* might consider this normal usage. */
|
||||
TEST_ASSERT(mbedtls_mutex_lock(&mutex) == 0);
|
||||
exit:
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
void mutex_unlock_not_initialized(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
mbedtls_threading_mutex_t mutex;
|
||||
memset(&mutex, 0, sizeof(mutex));
|
||||
/* This mutex usage error is detected by our test framework's mutex usage
|
||||
* verification framework. See tests/src/threading_helpers.c. Other
|
||||
* threading implementations (e.g. pthread without our instrumentation)
|
||||
* might consider this normal usage. */
|
||||
TEST_ASSERT(mbedtls_mutex_unlock(&mutex) == 0);
|
||||
exit:
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
void mutex_free_not_initialized(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
mbedtls_threading_mutex_t mutex;
|
||||
memset(&mutex, 0, sizeof(mutex));
|
||||
/* This mutex usage error is detected by our test framework's mutex usage
|
||||
* verification framework. See tests/src/threading_helpers.c. Other
|
||||
* threading implementations (e.g. pthread without our instrumentation)
|
||||
* might consider this normal usage. */
|
||||
mbedtls_mutex_free(&mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
void mutex_double_init(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
mbedtls_threading_mutex_t mutex;
|
||||
mbedtls_mutex_init(&mutex);
|
||||
/* This mutex usage error is detected by our test framework's mutex usage
|
||||
* verification framework. See tests/src/threading_helpers.c. Other
|
||||
* threading implementations (e.g. pthread without our instrumentation)
|
||||
* might consider this normal usage. */
|
||||
mbedtls_mutex_init(&mutex);
|
||||
mbedtls_mutex_free(&mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
void mutex_double_free(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
mbedtls_threading_mutex_t mutex;
|
||||
mbedtls_mutex_init(&mutex);
|
||||
mbedtls_mutex_free(&mutex);
|
||||
/* This mutex usage error is detected by our test framework's mutex usage
|
||||
* verification framework. See tests/src/threading_helpers.c. Other
|
||||
* threading implementations (e.g. pthread without our instrumentation)
|
||||
* might consider this normal usage. */
|
||||
mbedtls_mutex_free(&mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
void mutex_leak(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
mbedtls_threading_mutex_t mutex;
|
||||
mbedtls_mutex_init(&mutex);
|
||||
#endif
|
||||
/* This mutex usage error is detected by our test framework's mutex usage
|
||||
* verification framework. See tests/src/threading_helpers.c. Other
|
||||
* threading implementations (e.g. pthread without our instrumentation)
|
||||
* might consider this normal usage. */
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
/* Command line entry point */
|
||||
/****************************************************************/
|
||||
|
||||
typedef struct {
|
||||
/** Command line argument that will trigger that metatest.
|
||||
*
|
||||
* Conventionally matches "[a-z0-9_]+". */
|
||||
const char *name;
|
||||
|
||||
/** Platform under which that metatest is valid.
|
||||
*
|
||||
* - "any": should work anywhere.
|
||||
* - "asan": triggers ASan (Address Sanitizer).
|
||||
* - "msan": triggers MSan (Memory Sanitizer).
|
||||
* - "pthread": requires MBEDTLS_THREADING_PTHREAD and MBEDTLS_TEST_HOOKS,
|
||||
* which enables MBEDTLS_TEST_MUTEX_USAGE internally in the test
|
||||
* framework (see tests/src/threading_helpers.c).
|
||||
*/
|
||||
const char *platform;
|
||||
|
||||
/** Function that performs the metatest.
|
||||
*
|
||||
* The function receives the name as an argument. This allows using the
|
||||
* same function to perform multiple variants of a test based on the name.
|
||||
*
|
||||
* When executed on a conforming platform, the function is expected to
|
||||
* either cause a test failure (mbedtls_test_fail()), or cause the
|
||||
* program to abort in some way (e.g. by causing a segfault or by
|
||||
* triggering a sanitizer).
|
||||
*
|
||||
* When executed on a non-conforming platform, the function may return
|
||||
* normally or may have unpredictable behavior.
|
||||
*/
|
||||
void (*entry_point)(const char *name);
|
||||
} metatest_t;
|
||||
|
||||
/* The list of availble meta-tests. Remember to register new functions here!
|
||||
*
|
||||
* Note that we always compile all the functions, so that `metatest --list`
|
||||
* will always list all the available meta-tests.
|
||||
*
|
||||
* See the documentation of metatest_t::platform for the meaning of
|
||||
* platform values.
|
||||
*/
|
||||
metatest_t metatests[] = {
|
||||
{ "test_fail", "any", meta_test_fail },
|
||||
{ "null_dereference", "any", null_pointer_dereference },
|
||||
{ "null_call", "any", null_pointer_call },
|
||||
{ "read_after_free", "asan", read_after_free },
|
||||
{ "double_free", "asan", double_free },
|
||||
{ "read_uninitialized_stack", "msan", read_uninitialized_stack },
|
||||
{ "memory_leak", "asan", memory_leak },
|
||||
{ "mutex_lock_not_initialized", "pthread", mutex_lock_not_initialized },
|
||||
{ "mutex_unlock_not_initialized", "pthread", mutex_unlock_not_initialized },
|
||||
{ "mutex_free_not_initialized", "pthread", mutex_free_not_initialized },
|
||||
{ "mutex_double_init", "pthread", mutex_double_init },
|
||||
{ "mutex_double_free", "pthread", mutex_double_free },
|
||||
{ "mutex_leak", "pthread", mutex_leak },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void help(FILE *out, const char *argv0)
|
||||
{
|
||||
mbedtls_fprintf(out, "Usage: %s list|TEST\n", argv0);
|
||||
mbedtls_fprintf(out, "Run a meta-test that should cause a test failure.\n");
|
||||
mbedtls_fprintf(out, "With 'list', list the available tests and their platform requirement.\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *argv0 = argc > 0 ? argv[0] : "metatest";
|
||||
if (argc != 2) {
|
||||
help(stderr, argv0);
|
||||
mbedtls_exit(MBEDTLS_EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Support "-help", "--help", "--list", etc. */
|
||||
const char *command = argv[1];
|
||||
while (*command == '-') {
|
||||
++command;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "help") == 0) {
|
||||
help(stdout, argv0);
|
||||
mbedtls_exit(MBEDTLS_EXIT_SUCCESS);
|
||||
}
|
||||
if (strcmp(argv[1], "list") == 0) {
|
||||
for (const metatest_t *p = metatests; p->name != NULL; p++) {
|
||||
mbedtls_printf("%s %s\n", p->name, p->platform);
|
||||
}
|
||||
mbedtls_exit(MBEDTLS_EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
|
||||
mbedtls_test_mutex_usage_init();
|
||||
#endif
|
||||
|
||||
for (const metatest_t *p = metatests; p->name != NULL; p++) {
|
||||
if (strcmp(argv[1], p->name) == 0) {
|
||||
mbedtls_printf("Running metatest %s...\n", argv[1]);
|
||||
p->entry_point(argv[1]);
|
||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
|
||||
mbedtls_test_mutex_usage_check();
|
||||
#endif
|
||||
mbedtls_printf("Running metatest %s... done, result=%d\n",
|
||||
argv[1], (int) mbedtls_test_info.result);
|
||||
mbedtls_exit(mbedtls_test_info.result == MBEDTLS_TEST_RESULT_SUCCESS ?
|
||||
MBEDTLS_EXIT_SUCCESS :
|
||||
MBEDTLS_EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
mbedtls_fprintf(stderr, "%s: FATAL: No such metatest: %s\n",
|
||||
argv0, command);
|
||||
mbedtls_exit(MBEDTLS_EXIT_FAILURE);
|
||||
}
|
||||
|
|
@ -2,19 +2,7 @@
|
|||
* Query the Mbed TLS compile time configuration
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Query Mbed TLS compile time configurations from mbedtls_config.h
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_PROGRAMS_TEST_QUERY_CONFIG_H
|
||||
|
|
|
|||
|
|
@ -1,19 +1,7 @@
|
|||
/* Ad hoc report on included headers. */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <psa/crypto.h>
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Self-test demonstration program
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* UDP proxy: emulate an unreliable UDP connection for DTLS testing
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -3,19 +3,7 @@
|
|||
# Usage: udp_proxy_wrapper.sh [PROXY_PARAM...] -- [SERVER_PARAM...]
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed 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.
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
set -u
|
||||
|
||||
|
|
|
|||
|
|
@ -10,19 +10,7 @@
|
|||
* call to mbedtls_platform_zeroize() was not eliminated.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Convert PEM to DER
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Translate error code to error string
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Windows CE console application entry point
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Certificate reading application
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Certificate request generation
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
@ -261,6 +249,10 @@ usage:
|
|||
|
||||
if ((subtype_value = strchr(q, ':')) != NULL) {
|
||||
*subtype_value++ = '\0';
|
||||
} else {
|
||||
mbedtls_printf(
|
||||
"Invalid argument for option SAN: Entry must be of the form TYPE:value\n");
|
||||
goto usage;
|
||||
}
|
||||
if (strcmp(q, "RFC822") == 0) {
|
||||
cur->node.type = MBEDTLS_X509_SAN_RFC822_NAME;
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Certificate generation and signing
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
@ -583,6 +571,10 @@ usage:
|
|||
|
||||
if ((subtype_value = strchr(q, ':')) != NULL) {
|
||||
*subtype_value++ = '\0';
|
||||
} else {
|
||||
mbedtls_printf(
|
||||
"Invalid argument for option SAN: Entry must be of the form TYPE:value\n");
|
||||
goto usage;
|
||||
}
|
||||
if (strcmp(q, "RFC822") == 0) {
|
||||
cur->node.type = MBEDTLS_X509_SAN_RFC822_NAME;
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* CRL reading application
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -3,45 +3,6 @@
|
|||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*
|
||||
* This file is provided under the Apache License 2.0, or the
|
||||
* GNU General Public License v2.0 or later.
|
||||
*
|
||||
* **********
|
||||
* Apache License 2.0:
|
||||
*
|
||||
* Licensed 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.
|
||||
*
|
||||
* **********
|
||||
*
|
||||
* **********
|
||||
* GNU General Public License v2.0 or later:
|
||||
*
|
||||
* 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.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* **********
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
|
|
@ -2,19 +2,7 @@
|
|||
* Certificate request reading application
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed 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.
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue