2018-10-26 19:41:08 +02:00
|
|
|
/*
|
|
|
|
* Query the Mbed TLS compile time configuration
|
|
|
|
*
|
2020-08-07 13:07:28 +02:00
|
|
|
* Copyright The Mbed TLS Contributors
|
2018-10-26 19:41:08 +02:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2021-05-27 11:25:03 +02:00
|
|
|
#include "mbedtls/build_info.h"
|
2018-10-26 19:41:08 +02:00
|
|
|
|
|
|
|
#if defined(MBEDTLS_PLATFORM_C)
|
|
|
|
#include "mbedtls/platform.h"
|
|
|
|
#else
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#define mbedtls_printf printf
|
|
|
|
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define USAGE \
|
2021-12-06 06:44:39 +01:00
|
|
|
"usage: %s <MBEDTLS_CONFIG> | -l\n\n" \
|
2018-10-26 19:41:08 +02:00
|
|
|
"This program takes one command line argument which corresponds to\n" \
|
|
|
|
"the string representation of a Mbed TLS compile time configuration.\n" \
|
|
|
|
"The value 0 will be returned if this configuration is defined in the\n" \
|
|
|
|
"Mbed TLS build and the macro expansion of that configuration will be\n" \
|
2021-12-06 06:44:39 +01:00
|
|
|
"printed (if any). Otherwise, 1 will be returned.\n" \
|
|
|
|
"-l\tPrint all available configuration"
|
|
|
|
#include <string.h>
|
2021-01-12 15:55:10 +01:00
|
|
|
#include "query_config.h"
|
2018-10-26 19:41:08 +02:00
|
|
|
|
|
|
|
int main( int argc, char *argv[] )
|
|
|
|
{
|
|
|
|
if ( argc != 2 )
|
|
|
|
{
|
|
|
|
mbedtls_printf( USAGE, argv[0] );
|
|
|
|
return( MBEDTLS_EXIT_FAILURE );
|
|
|
|
}
|
|
|
|
|
2021-12-06 06:44:39 +01:00
|
|
|
if( strcmp( argv[1], "-l" ) == 0 )
|
|
|
|
{
|
|
|
|
list_config();
|
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
|
2018-10-26 19:41:08 +02:00
|
|
|
return( query_config( argv[1] ) );
|
|
|
|
}
|