diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 17d31e951..2bd41c0af 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,9 +20,9 @@ function(add_test_suite suite_name) add_custom_command( OUTPUT test_suite_${data_name}.c COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.pl ${CMAKE_CURRENT_SOURCE_DIR}/suites test_suite_${suite_name} test_suite_${data_name} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.pl polarssl fct.h suites/helpers.function suites/test_suite_${suite_name}.function suites/test_suite_${data_name}.data + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_code.pl polarssl suites/helpers.function suites/main_test.function suites/test_suite_${suite_name}.function suites/test_suite_${data_name}.data ) - + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_executable(test_suite_${data_name} test_suite_${data_name}.c) target_link_libraries(test_suite_${data_name} ${libs}) diff --git a/tests/Makefile b/tests/Makefile index b78062c55..b2a5fe65c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -54,71 +54,71 @@ APPS = test_suite_aes.ecb test_suite_aes.cbc \ all: $(APPS) -test_suite_aes.ecb.c : suites/test_suite_aes.function suites/test_suite_aes.ecb.data scripts/generate_code.pl suites/helpers.function +test_suite_aes.ecb.c : suites/test_suite_aes.function suites/test_suite_aes.ecb.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_aes test_suite_aes.ecb -test_suite_aes.cbc.c : suites/test_suite_aes.function suites/test_suite_aes.cbc.data scripts/generate_code.pl suites/helpers.function +test_suite_aes.cbc.c : suites/test_suite_aes.function suites/test_suite_aes.cbc.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_aes test_suite_aes.cbc -test_suite_aes.cfb.c : suites/test_suite_aes.function suites/test_suite_aes.cfb.data scripts/generate_code.pl suites/helpers.function +test_suite_aes.cfb.c : suites/test_suite_aes.function suites/test_suite_aes.cfb.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_aes test_suite_aes.cfb -test_suite_aes.rest.c : suites/test_suite_aes.function suites/test_suite_aes.rest.data scripts/generate_code.pl suites/helpers.function +test_suite_aes.rest.c : suites/test_suite_aes.function suites/test_suite_aes.rest.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_aes test_suite_aes.rest -test_suite_cipher.aes.c : suites/test_suite_cipher.function suites/test_suite_cipher.aes.data scripts/generate_code.pl suites/helpers.function +test_suite_cipher.aes.c : suites/test_suite_cipher.function suites/test_suite_cipher.aes.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.aes -test_suite_cipher.blowfish.c : suites/test_suite_cipher.function suites/test_suite_cipher.blowfish.data scripts/generate_code.pl suites/helpers.function +test_suite_cipher.blowfish.c : suites/test_suite_cipher.function suites/test_suite_cipher.blowfish.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.blowfish -test_suite_cipher.camellia.c : suites/test_suite_cipher.function suites/test_suite_cipher.camellia.data scripts/generate_code.pl suites/helpers.function +test_suite_cipher.camellia.c : suites/test_suite_cipher.function suites/test_suite_cipher.camellia.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.camellia -test_suite_cipher.des.c : suites/test_suite_cipher.function suites/test_suite_cipher.des.data scripts/generate_code.pl suites/helpers.function +test_suite_cipher.des.c : suites/test_suite_cipher.function suites/test_suite_cipher.des.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.des -test_suite_cipher.null.c : suites/test_suite_cipher.function suites/test_suite_cipher.null.data scripts/generate_code.pl suites/helpers.function +test_suite_cipher.null.c : suites/test_suite_cipher.function suites/test_suite_cipher.null.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.null -test_suite_cipher.padding.c : suites/test_suite_cipher.function suites/test_suite_cipher.padding.data scripts/generate_code.pl suites/helpers.function +test_suite_cipher.padding.c : suites/test_suite_cipher.function suites/test_suite_cipher.padding.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_cipher test_suite_cipher.padding -test_suite_gcm.decrypt_128.c : suites/test_suite_gcm.function suites/test_suite_gcm.decrypt_128.data scripts/generate_code.pl suites/helpers.function +test_suite_gcm.decrypt_128.c : suites/test_suite_gcm.function suites/test_suite_gcm.decrypt_128.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_gcm test_suite_gcm.decrypt_128 -test_suite_gcm.decrypt_192.c : suites/test_suite_gcm.function suites/test_suite_gcm.decrypt_192.data scripts/generate_code.pl suites/helpers.function +test_suite_gcm.decrypt_192.c : suites/test_suite_gcm.function suites/test_suite_gcm.decrypt_192.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_gcm test_suite_gcm.decrypt_192 -test_suite_gcm.decrypt_256.c : suites/test_suite_gcm.function suites/test_suite_gcm.decrypt_256.data scripts/generate_code.pl suites/helpers.function +test_suite_gcm.decrypt_256.c : suites/test_suite_gcm.function suites/test_suite_gcm.decrypt_256.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_gcm test_suite_gcm.decrypt_256 -test_suite_gcm.encrypt_128.c : suites/test_suite_gcm.function suites/test_suite_gcm.encrypt_128.data scripts/generate_code.pl suites/helpers.function +test_suite_gcm.encrypt_128.c : suites/test_suite_gcm.function suites/test_suite_gcm.encrypt_128.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_gcm test_suite_gcm.encrypt_128 -test_suite_gcm.encrypt_192.c : suites/test_suite_gcm.function suites/test_suite_gcm.encrypt_192.data scripts/generate_code.pl suites/helpers.function +test_suite_gcm.encrypt_192.c : suites/test_suite_gcm.function suites/test_suite_gcm.encrypt_192.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_gcm test_suite_gcm.encrypt_192 -test_suite_gcm.encrypt_256.c : suites/test_suite_gcm.function suites/test_suite_gcm.encrypt_256.data scripts/generate_code.pl suites/helpers.function +test_suite_gcm.encrypt_256.c : suites/test_suite_gcm.function suites/test_suite_gcm.encrypt_256.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites test_suite_gcm test_suite_gcm.encrypt_256 -%.c : suites/%.function suites/%.data scripts/generate_code.pl suites/helpers.function +%.c : suites/%.function suites/%.data scripts/generate_code.pl suites/helpers.function suites/main_test.function echo " Generate $@" scripts/generate_code.pl suites $* $* diff --git a/tests/fct.h b/tests/fct.h deleted file mode 100644 index 78bc27bfe..000000000 --- a/tests/fct.h +++ /dev/null @@ -1,3959 +0,0 @@ -/* -==================================================================== -Copyright (c) 2008 Ian Blumel. All rights reserved. - -FCTX (Fast C Test) Unit Testing Framework - -Copyright (c) 2008, Ian Blumel (ian.blumel@gmail.com) -All rights reserved. - -This license is based on the BSD License. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of, Ian Blumel, nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================== - -File: fct.h -*/ - -#if !defined(FCT_INCLUDED__IMB) -#define FCT_INCLUDED__IMB - -/* Configuration Values. You can over-ride these values in your own -header, then include this header. For example, in your file, myfct.h, - - #define FCT_DEFAULT_LOGGER "standard" - #include "fct.h" - -then if your unit tests included, myfct.h, you would default to work -with a standard logger. */ - -#if !defined(FCT_DEFAULT_LOGGER) -# define FCT_DEFAULT_LOGGER "standard" -#endif /* !FCT_DEFAULT_LOGGER */ - -#define FCT_VERSION_MAJOR 1 -#define FCT_VERSION_MINOR 6 -#define FCT_VERSION_MICRO 1 - -#define _FCT_QUOTEME(x) #x -#define FCT_QUOTEME(x) _FCT_QUOTEME(x) - -#define FCT_VERSION_STR (FCT_QUOTEME(FCT_VERSION_MAJOR) "."\ - FCT_QUOTEME(FCT_VERSION_MINOR) "."\ - FCT_QUOTEME(FCT_VERSION_MICRO)) - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define FCT_MAX_NAME 256 -#define FCT_MAX_LOG_LINE 256 - -#define nbool_t int -#define FCT_TRUE 1 -#define FCT_FALSE 0 - -#define FCTMIN(x, y) ( x < y) ? (x) : (y) - -#ifndef __INTEL_COMPILER -/* Use regular assertions for non-Intel compilers */ -#define FCT_ASSERT(expr) assert(expr) -#else -/* Silence Intel warnings on assert(expr && "str") or assert("str") */ -#define FCT_ASSERT(expr) do { \ - _Pragma("warning(push,disable:279)"); \ - assert(expr); \ - _Pragma("warning(pop)"); \ - } while (0) -#endif - -#if defined(__cplusplus) -#define FCT_EXTERN_C extern "C" -#else -#define FCT_EXTERN_C -#endif - -/* Forward declarations. The following forward declarations are required -because there is a inter-relationship between certain objects that -just can not be untwined. */ -typedef struct _fct_logger_evt_t fct_logger_evt_t; -typedef struct _fct_logger_i fct_logger_i; -typedef struct _fct_logger_types_t fct_logger_types_t; -typedef struct _fct_standard_logger_t fct_standard_logger_t; -typedef struct _fct_junit_logger_t fct_junit_logger_t; -typedef struct _fct_minimal_logger_t fct_minimal_logger_t; -typedef struct _fctchk_t fctchk_t; -typedef struct _fct_test_t fct_test_t; -typedef struct _fct_ts_t fct_ts_t; -typedef struct _fctkern_t fctkern_t; - -/* Forward declare some functions used throughout. */ -static fct_logger_i* -fct_standard_logger_new(void); - -static fct_logger_i* -fct_minimal_logger_new(void); - -static fct_junit_logger_t * -fct_junit_logger_new(void); - -static void -fct_logger__del(fct_logger_i *logger); - -static void -fct_logger__on_chk(fct_logger_i *self, fctchk_t const *chk); - -static void -fct_logger__on_test_start(fct_logger_i *logger, fct_test_t const *test); - -static void -fct_logger__on_test_end(fct_logger_i *logger, fct_test_t *test); - -static void -fct_logger__on_test_suite_start(fct_logger_i *logger, fct_ts_t const *ts); - -static void -fct_logger__on_test_suite_end(fct_logger_i *logger, fct_ts_t const *ts); - -static void -fct_logger__on_test_suite_skip( - fct_logger_i *logger, - char const *condition, - char const *name -); - -static void -fct_logger__on_test_skip( - fct_logger_i *logger, - char const *condition, - char const *name -); - - -static void -fct_logger__on_warn(fct_logger_i *logger, char const *warn); - - - -/* Explicitly indicate a no-op */ -#define fct_pass() - -#define fct_unused(x) (void)(x) - -/* This is just a little trick to let me put comments inside of macros. I -really only want to bother with this when we are "unwinding" the macros -for debugging purposes. */ -#if defined(FCT_CONF_UNWIND) -# define _fct_cmt(string) {char*_=string;} -#else -# define _fct_cmt(string) -#endif - -/* --------------------------------------------------------- -UTILITIES --------------------------------------------------------- -*/ - - -/* STDIO and STDERR redirect support */ -#define FCT_PIPE_RESERVE_BYTES_DEFAULT 512 -static int fct_stdout_pipe[2]; -static int fct_stderr_pipe[2]; -static int fct_saved_stdout; -static int fct_saved_stderr; - -/* Platform indepedent pipe functions. TODO: Look to figure this out in a way -that follows the ISO C++ conformant naming convention. */ -#if defined(WIN32) -# include -# include -# define _fct_pipe(_PFDS_) \ - _pipe((_PFDS_), FCT_PIPE_RESERVE_BYTES_DEFAULT, _O_TEXT) -# define _fct_dup _dup -# define _fct_dup2 _dup2 -# define _fct_close _close -# define _fct_read _read -/* Until I can figure a better way to do this, rely on magic numbers. */ -# define STDOUT_FILENO 1 -# define STDERR_FILENO 2 -#else -# include -# define _fct_pipe pipe -# define _fct_dup dup -# define _fct_dup2 dup2 -# define _fct_close close -# define _fct_read read -#endif /* WIN32 */ - - - - -static void -fct_switch_std_to_buffer(int std_pipe[2], FILE *out, int fileno_, int *save_handle) -{ - fflush(out); - *save_handle = _fct_dup(fileno_); - if ( _fct_pipe(std_pipe) != 0 ) - { - exit(1); - } - _fct_dup2(std_pipe[1], fileno_); - _fct_close(std_pipe[1]); -} - - -static void -fct_switch_std_to_std(FILE *out, int fileno_, int save_handle) -{ - fflush(out); - _fct_dup2(save_handle, fileno_); -} - - -#define FCT_SWITCH_STDOUT_TO_BUFFER() \ - fct_switch_std_to_buffer(fct_stdout_pipe, stdout, STDOUT_FILENO, &fct_saved_stdout) -#define FCT_SWITCH_STDOUT_TO_STDOUT() \ - fct_switch_std_to_std(stdout, STDOUT_FILENO, fct_saved_stdout) -#define FCT_SWITCH_STDERR_TO_BUFFER() \ - fct_switch_std_to_buffer(fct_stderr_pipe, stderr, STDERR_FILENO, &fct_saved_stderr) -#define FCT_SWITCH_STDERR_TO_STDERR() \ - fct_switch_std_to_std(stderr, STDERR_FILENO, fct_saved_stderr) - - -/* Utility for truncated, safe string copies. The NUM -should be the length of DST plus the null-termintor. */ -static void -fctstr_safe_cpy(char *dst, char const *src, size_t num) -{ - FCT_ASSERT( dst != NULL ); - FCT_ASSERT( src != NULL ); - FCT_ASSERT( num > 0 ); -#if defined(WIN32) && _MSC_VER >= 1400 - strncpy_s(dst, num, src, _TRUNCATE); -#else - strncpy(dst, src, num); -#endif - dst[num-1] = '\0'; -} - -/* Isolate the vsnprintf implementation */ -static int -fct_vsnprintf(char *buffer, - size_t buffer_len, - char const *format, - va_list args) -{ - int count =0; - /* Older microsoft compilers where not ANSI compliant with this - function and you had to use _vsnprintf. I will assume that newer - Microsoft Compilers start implementing vsnprintf. */ -#if defined(_MSC_VER) && (_MSC_VER < 1400) - count = _vsnprintf(buffer, buffer_len, format, args); -#elif defined(_MSC_VER) && (_MSC_VER >= 1400) - count = vsnprintf_s(buffer, buffer_len, _TRUNCATE, format, args); -#else - count = vsnprintf(buffer, buffer_len, format, args); -#endif - return count; -} - - -/* Isolate the snprintf implemenation. */ -static int -fct_snprintf(char *buffer, size_t buffer_len, char const *format, ...) -{ - int count =0; - va_list args; - va_start(args, format); - count =fct_vsnprintf(buffer, buffer_len, format, args); - va_end(args); - return count; -} - - -/* Helper to for cloning strings on the heap. Returns NULL for -an out of memory condition. */ -static char* -fctstr_clone(char const *s) -{ - char *k =NULL; - size_t klen =0; - FCT_ASSERT( s != NULL && "invalid arg"); - klen = strlen(s)+1; - k = (char*)malloc(sizeof(char)*klen+1); - fctstr_safe_cpy(k, s, klen); - return k; -} - - -/* Clones and returns a lower case version of the original string. */ -static char* -fctstr_clone_lower(char const *s) -{ - char *k =NULL; - size_t klen =0; - size_t i; - if ( s == NULL ) - { - return NULL; - } - klen = strlen(s)+1; - k = (char*)malloc(sizeof(char)*klen+1); - for ( i=0; i != klen; ++i ) - { - k[i] = (char)tolower((int)s[i]); - } - return k; -} - - -/* A very, very simple "filter". This just compares the supplied prefix -against the test_str, to see if they both have the same starting -characters. If they do we return true, otherwise we return false. If the -prefix is a blank string or NULL, then it will return FCT_TRUE.*/ -static nbool_t -fct_filter_pass(char const *prefix, char const *test_str) -{ - nbool_t is_match = FCT_FALSE; - char const *prefix_p; - char const *test_str_p; - - /* If you got nothing to test against, why test? */ - FCT_ASSERT( test_str != NULL ); - - /* When the prefix is NULL or blank, we always return FCT_TRUE. */ - if ( prefix == NULL || prefix[0] == '\0' ) - { - return FCT_TRUE; - } - - /* Iterate through both character arrays at the same time. We are - going to play a game and see if we can beat the house. */ - for ( prefix_p = prefix, test_str_p = test_str; - *prefix_p != '\0' && *test_str_p != '\0'; - ++prefix_p, ++test_str_p ) - { - is_match = *prefix_p == *test_str_p; - if ( !is_match ) - { - break; /* Quit the first time we don't match. */ - } - } - - /* If the iterator for the test_str is pointing at the null char, and - the iterator for the prefix string is not, then the prefix string is - larger than the actual test string, and therefore we failed to pass the - filter. */ - if ( *test_str_p == '\0' && *prefix_p != '\0' ) - { - return FCT_FALSE; - } - - /* is_match will be set to the either FCT_TRUE if we kicked of the loop - early because our filter ran out of characters or FCT_FALSE if we - encountered a mismatch before our filter ran out of characters. */ - return is_match; -} - - -/* Routine checks if two strings are equal. Taken from -http://publications.gbdirect.co.uk/c_book/chapter5/character_handling.html -*/ -static int -fctstr_eq(char const *s1, char const *s2) -{ - if ( s1 == s2 ) - { - return 1; - } - if ( (s1 == NULL && s2 != NULL) - || (s1 != NULL && s2 == NULL) ) - { - return 0; - } - while (*s1 == *s2) - { - if (*s1 == '\0') - return 1; - s1++; - s2++; - } - /* Difference detected! */ - return 0; -} - - -static int -fctstr_ieq(char const *s1, char const *s2) -{ - if ( s1 == s2 ) - { - return 1; - } - if ( (s1 == NULL && s2 != NULL) - || (s1 != NULL && s2 == NULL) ) - { - return 0; - } - while (tolower((int)*s1) == tolower((int)*s2)) - { - if (*s1 == '\0') - return 1; - s1++; - s2++; - } - /* Difference detected! */ - return 0; -} - - -/* Returns 1 if the STR contains the CHECK_INCL substring. NULL's -are handled, and NULL always INCLUDES NULL. This check is case -sensitive. If two strings point to the same place they are -included. */ -static int -fctstr_incl(char const *str, char const *check_incl) -{ - static char const *blank_s = ""; - char const *found = NULL; - if ( str == NULL ) - { - str = blank_s; - } - if ( check_incl == NULL ) - { - check_incl = blank_s; - } - if ( str == check_incl ) - { - return 1; - } - found = strstr(str, check_incl); - return found != NULL; -} - - -/* Does a case insensitive include check. */ -static int -fctstr_iincl(char const *str, char const *check_incl) -{ - /* Going to do this with a memory allocation to save coding - time. In the future this can be rewritten. Both clone_lower - and _incl are NULL tolerant. */ - char *lstr = fctstr_clone_lower(str); - char *lcheck_incl = fctstr_clone_lower(check_incl); - int found = fctstr_incl(lstr, lcheck_incl); - free(lstr); - free(lcheck_incl); - return found; -} - - -/* Returns true if STR starts with CHECK. NULL and NULL is consider -true. */ -static int -fctstr_startswith(char const *str, char const *check) -{ - char const *sp; - if ( str == NULL && check == NULL ) - { - return 1; - } - else if ( ((str == NULL) && (check != NULL)) - || ((str != NULL) && (check == NULL)) ) - { - return 0; - } - sp = strstr(str, check); - return sp == str; -} - - -/* Case insenstive variant of fctstr_startswith. */ -static int -fctstr_istartswith(char const *str, char const *check) -{ - /* Taking the lazy approach for now. */ - char *istr = fctstr_clone_lower(str); - char *icheck = fctstr_clone_lower(check); - /* TODO: check for memory. */ - int startswith = fctstr_startswith(istr, icheck); - free(istr); - free(icheck); - return startswith; -} - - -/* Returns true if the given string ends with the given -check. Treats NULL as a blank string, and as such, will -pass the ends with (a blank string endswith a blank string). */ -static int -fctstr_endswith(char const *str, char const *check) -{ - size_t check_i; - size_t str_i; - if ( str == NULL && check == NULL ) - { - return 1; - } - else if ( ((str == NULL) && (check != NULL)) - || ((str != NULL) && (check == NULL)) ) - { - return 0; - } - check_i = strlen(check); - str_i = strlen(str); - if ( str_i < check_i ) - { - return 0; /* Can't do it string is too small. */ - } - for ( ; check_i != 0; --check_i, --str_i) - { - if ( str[str_i] != check[check_i] ) - { - return 0; /* Found a case where they are not equal. */ - } - } - /* Exahausted check against string, can only be true. */ - return 1; -} - - -static int -fctstr_iendswith(char const *str, char const *check) -{ - size_t check_i; - size_t str_i; - if ( str == NULL && check == NULL ) - { - return 1; - } - else if ( ((str == NULL) && (check != NULL)) - || ((str != NULL) && (check == NULL)) ) - { - return 0; - } - check_i = strlen(check); - str_i = strlen(str); - if ( str_i < check_i ) - { - return 0; /* Can't do it string is too small. */ - } - for ( ; check_i != 0; --check_i, --str_i) - { - if ( tolower((int)str[str_i]) != tolower((int)check[check_i]) ) - { - return 0; /* Found a case where they are not equal. */ - } - } - /* Exahausted check against string, can only be true. */ - return 1; -} - - -/* Use this with the _end variant to get the - -STARTSWITH ........................................ END - -effect. Assumes that the line will be maxwidth in characters. The -maxwidth can't be greater than FCT_DOTTED_MAX_LEN. */ -#define FCT_DOTTED_MAX_LEN 256 -static void -fct_dotted_line_start(size_t maxwidth, char const *startwith) -{ - char line[FCT_DOTTED_MAX_LEN]; - size_t len =0; - size_t line_len =0; - - memset(line, '.', sizeof(char)*maxwidth); - len = strlen(startwith); - line_len = FCTMIN(maxwidth-1, len); - memcpy(line, startwith, sizeof(char)*line_len); - if ( len < maxwidth-1) - { - line[len] = ' '; - } - line[maxwidth-1] = '\0'; - fputs(line, stdout); -} - - -static void -fct_dotted_line_end(char const *endswith) -{ - printf(" %s\n", endswith); -} - - -/* --------------------------------------------------------- -TIMER --------------------------------------------------------- -This is a low-res implementation at the moment. - -We will improve this in the future, and isolate the -implementation from the rest of the code. -*/ - -typedef struct _fct_timer_t fct_timer_t; -struct _fct_timer_t -{ - clock_t start; - clock_t stop; - double duration; -}; - - -static void -fct_timer__init(fct_timer_t *timer) -{ - FCT_ASSERT(timer != NULL); - memset(timer, 0, sizeof(fct_timer_t)); -} - - -static void -fct_timer__start(fct_timer_t *timer) -{ - FCT_ASSERT(timer != NULL); - timer->start = clock(); -} - - -static void -fct_timer__stop(fct_timer_t *timer) -{ - FCT_ASSERT(timer != NULL); - timer->stop = clock(); - timer->duration = (double) (timer->stop - timer->start) / CLOCKS_PER_SEC; -} - - -/* Returns the time in seconds. */ -static double -fct_timer__duration(fct_timer_t const *timer) -{ - FCT_ASSERT( timer != NULL ); - return timer->duration; -} - - -/* --------------------------------------------------------- -GENERIC LIST --------------------------------------------------------- -*/ - -/* For now we will just keep it at a linear growth rate. */ -#define FCT_LIST_GROWTH_FACTOR 2 - -/* Starting size for the list, to keep it simple we will start -at a reasonable size. */ -#define FCT_LIST_DEFAULT_START_SZ 8 - -/* Helper macros for quickly iterating through a list. You should be able -to do something like, - - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, my_list) - { - fct_logger__on_blah(logger); - } - FCT_NLIST_FOREACH_END(); - -*/ -#define FCT_NLIST_FOREACH_BGN(Type, Var, List)\ -{\ - if ( List != NULL ) {\ - size_t item_i##Var;\ - size_t num_items##Var = fct_nlist__size(List);\ - for( item_i##Var =0; item_i##Var != num_items##Var; ++item_i##Var )\ - {\ - Type Var = (Type) fct_nlist__at((List), item_i##Var); - -#define FCT_NLIST_FOREACH_END() }}} - -/* Used to manage a list of loggers. This works mostly like -the STL vector, where the array grows as more items are -appended. */ -typedef struct _fct_nlist_t fct_nlist_t; -struct _fct_nlist_t -{ - /* Item's are stored as pointers to void. */ - void **itm_list; - - /* Indicates the number of element's in the array. */ - size_t avail_itm_num; - - /* Indicates the number of actually elements in the array. */ - size_t used_itm_num; -}; -typedef void (*fct_nlist_on_del_t)(void*); - - -/* Clears the contents of the list, and sets the list count to 0. The -actual count remains unchanged. If on_del is supplied it is executed -against each list element. */ -static void -fct_nlist__clear(fct_nlist_t *list, fct_nlist_on_del_t on_del) -{ - size_t itm_i__ =0; - FCT_ASSERT( list != NULL ); - if ( on_del != NULL ) - { - for ( itm_i__=0; itm_i__ != list->used_itm_num; ++itm_i__ ) - { - on_del(list->itm_list[itm_i__]); - } - } - list->used_itm_num =0; -} - - -/* If you used init, then close with final. This is useful for -working with structures that live on the stack. */ -static void -fct_nlist__final(fct_nlist_t *list, fct_nlist_on_del_t on_del) -{ - FCT_ASSERT( list != NULL ); - fct_nlist__clear(list, on_del); - free(list->itm_list); -} - - -static int -fct_nlist__init2(fct_nlist_t *list, size_t start_sz) -{ - FCT_ASSERT( list != NULL ); - if ( start_sz == 0 ) - { - list->itm_list = NULL; - } - else - { - list->itm_list = (void**)malloc(sizeof(void*)*start_sz); - if ( list->itm_list == NULL ) - { - return 0; - } - } - /* If these are both 0, then they are equal and that means - that the first append operation will allocate memory. The beauty - here is that if the list remains empty, then we save a malloc. - Empty lists are relatively common in FCT (consider an error list). */ - list->avail_itm_num = start_sz; - list->used_itm_num =0; - return 1; -} - - -/* Initializes a list. Useful for populating existing structures. -Returns 0 if there was an error allocating memory. Returns 1 otherwise. */ -#define fct_nlist__init(_LIST_PTR_) \ - (fct_nlist__init2((_LIST_PTR_), FCT_LIST_DEFAULT_START_SZ)) - - -/* Returns the number of elements within the list. */ -static size_t -fct_nlist__size(fct_nlist_t const *list) -{ - FCT_ASSERT( list != NULL ); - return list->used_itm_num; -} - - -/* Returns the item at idx, asserts otherwise. */ -static void* -fct_nlist__at(fct_nlist_t const *list, size_t idx) -{ - FCT_ASSERT( list != NULL ); - FCT_ASSERT( idx < list->used_itm_num ); - return list->itm_list[idx]; -} - - -static void -fct_nlist__append(fct_nlist_t *list, void *itm) -{ - FCT_ASSERT( list != NULL ); - /* If we ran out of room, then the last increment should be equal to the - available space, in this case we need to grow a little more. If this - list started as size 0, then we should encounter the same effect as - "running out of room." */ - if ( list->used_itm_num == list->avail_itm_num ) - { - /* Use multiple and add, since the avail_itm_num could be 0. */ - list->avail_itm_num = list->avail_itm_num*FCT_LIST_GROWTH_FACTOR+\ - FCT_LIST_GROWTH_FACTOR; - list->itm_list = (void**)realloc( - list->itm_list, sizeof(void*)*list->avail_itm_num - ); - FCT_ASSERT( list->itm_list != NULL && "memory check"); - } - - list->itm_list[list->used_itm_num] = itm; - ++(list->used_itm_num); -} - - - -/* ------------------------------------------------------------ -A SINGLE CHECK ------------------------------------------------------------ -This defines a single check. It indicates what the check was, -and where it occurred. A "Test" object will have-a bunch -of "checks". -*/ - -struct _fctchk_t -{ - /* This string that represents the condition. */ - char cndtn[FCT_MAX_LOG_LINE]; - - /* These indicate where the condition occurred. */ - char file[FCT_MAX_LOG_LINE]; - - int lineno; - - nbool_t is_pass; - - /* This is a message that we can "format into", if - no format string is specified this should be - equivalent to the cntdn. */ - char msg[FCT_MAX_LOG_LINE]; -}; - -#define fctchk__is_pass(_CHK_) ((_CHK_)->is_pass) -#define fctchk__file(_CHK_) ((_CHK_)->file) -#define fctchk__lineno(_CHK_) ((_CHK_)->lineno) -#define fctchk__cndtn(_CHK_) ((_CHK_)->cndtn) -#define fctchk__msg(_CHK_) ((_CHK_)->msg) - -static fctchk_t* -fctchk_new(int is_pass, - char const *cndtn, - char const *file, - int lineno, - char const *format, - va_list args) -{ - fctchk_t *chk = NULL; - - FCT_ASSERT( cndtn != NULL ); - FCT_ASSERT( file != NULL ); - FCT_ASSERT( lineno > 0 ); - - chk = (fctchk_t*)calloc(1, sizeof(fctchk_t)); - if ( chk == NULL ) - { - return NULL; - } - - fctstr_safe_cpy(chk->cndtn, cndtn, FCT_MAX_LOG_LINE); - fctstr_safe_cpy(chk->file, file, FCT_MAX_LOG_LINE); - chk->lineno = lineno; - - chk->is_pass =is_pass; - - if ( format != NULL ) - { - fct_vsnprintf(chk->msg, FCT_MAX_LOG_LINE, format, args); - } - else - { - /* Default to make the condition be the message, if there was no format - specified. */ - fctstr_safe_cpy(chk->msg, cndtn, FCT_MAX_LOG_LINE); - } - - return chk; -} - - -/* Cleans up a "check" object. If the `chk` is NULL, this function does -nothing. */ -static void -fctchk__del(fctchk_t *chk) -{ - if ( chk == NULL ) - { - return; - } - free( chk ); -} - - -/* ------------------------------------------------------------ -A TEST ------------------------------------------------------------ -A suite will have-a list of tests. Where each test will have-a -list of failed and passed checks. -*/ - -struct _fct_test_t -{ - /* List of failed and passed "checks" (fctchk_t). Two seperate - lists make it faster to determine how many checks passed and how - many checks failed. */ - fct_nlist_t failed_chks; - fct_nlist_t passed_chks; - - /* To store the test run time */ - fct_timer_t timer; - - /* The name of the test case. */ - char name[FCT_MAX_NAME]; -}; - -#define fct_test__name(_TEST_) ((_TEST_)->name) - -/* Clears the failed tests ... partly for internal testing. */ -#define fct_test__clear_failed(test) \ - fct_nlist__clear(test->failed_chks, (fct_nlist_on_del_t)fctchk__del);\ - - -static void -fct_test__del(fct_test_t *test) -{ - if (test == NULL ) - { - return; - } - fct_nlist__final(&(test->passed_chks), (fct_nlist_on_del_t)fctchk__del); - fct_nlist__final(&(test->failed_chks), (fct_nlist_on_del_t)fctchk__del); - free(test); -} - - -static fct_test_t* -fct_test_new(char const *name) -{ - nbool_t ok =FCT_FALSE; - fct_test_t *test =NULL; - - test = (fct_test_t*)malloc(sizeof(fct_test_t)); - if ( test == NULL ) - { - return NULL; - } - - fctstr_safe_cpy(test->name, name, FCT_MAX_NAME); - - /* Failures are an exception, so lets not allocate up - the list until we need to. */ - fct_nlist__init2(&(test->failed_chks), 0); - if (!fct_nlist__init(&(test->passed_chks))) - { - ok =FCT_FALSE; - goto finally; - } - - fct_timer__init(&(test->timer)); - - ok =FCT_TRUE; -finally: - if ( !ok ) - { - fct_test__del(test); - test =NULL; - } - return test; -} - - -static void -fct_test__start_timer(fct_test_t *test) -{ - FCT_ASSERT( test != NULL ); - fct_timer__start(&(test->timer)); -} - - -static void -fct_test__stop_timer(fct_test_t *test) -{ - FCT_ASSERT( test != NULL ); - fct_timer__stop(&(test->timer)); -} - - -static double -fct_test__duration(fct_test_t const *test) -{ - FCT_ASSERT( test != NULL ); - return fct_timer__duration(&(test->timer)); -} - - -static nbool_t -fct_test__is_pass(fct_test_t const *test) -{ - FCT_ASSERT( test != NULL ); - return fct_nlist__size(&(test->failed_chks)) == 0; -} - - -static void -fct_test__add(fct_test_t *test, fctchk_t *chk) -{ - - FCT_ASSERT( test != NULL ); - FCT_ASSERT( chk != NULL ); - - if ( fctchk__is_pass(chk) ) - { - fct_nlist__append(&(test->passed_chks), (void*)chk); - } - else - { - fct_nlist__append(&(test->failed_chks), (void*)chk); - } -} - -/* Returns the number of checks made throughout the test. */ -static size_t -fct_test__chk_cnt(fct_test_t const *test) -{ - FCT_ASSERT( test != NULL ); - return fct_nlist__size(&(test->failed_chks)) \ - + fct_nlist__size(&(test->passed_chks)); -} - - -/* ------------------------------------------------------------ -TEST SUITE (TS) ------------------------------------------------------------ -*/ - - -/* The different types of 'modes' that a test suite can be in. - -While the test suite is iterating through all the tests, its "State" -can change from "setup mode", to "test mode" to "tear down" mode. -These help to indicate what mode are currently in. Think of it as a -basic FSM. - - if the count was 0 end - +--------->---------------------> ending_mode-----+-+ - | ^ | - ^ | ^ -start | [if no more tests] | - | | | | - +-count_mode -> setup_mode -> test_mode -> teardown_mode->-+ - | ^ | | - | +-----------<---------------+ | - +----------->---[if fct_req fails]--------+ - -*/ -enum ts_mode -{ - ts_mode_cnt, /* To setup when done counting. */ - ts_mode_setup, /* To test when done setup. */ - ts_mode_teardown, /* To ending mode, when no more tests. */ - ts_mode_test, /* To tear down mode. */ - ts_mode_ending, /* To ... */ - ts_mode_end, /* .. The End. */ - ts_mode_abort /* Abort */ -}; - -/* Types of states the test could be in. */ -typedef enum -{ - fct_test_status_SUCCESS, - fct_test_status_FAILURE -} fct_test_status; - - -struct _fct_ts_t -{ - /* For counting our 'current' test number, and the total number of - tests. */ - int curr_test_num; - int total_test_num; - - /* Keeps track of the current state of the object while it is walking - through its "FSM" */ - enum ts_mode mode; - - /* The name of the test suite. */ - char name[FCT_MAX_NAME]; - - /* List of tests that where executed within the test suite. */ - fct_nlist_t test_list; -}; - - -#define fct_ts__is_setup_mode(ts) ((ts)->mode == ts_mode_setup) -#define fct_ts__is_teardown_mode(ts) ((ts)->mode == ts_mode_teardown) -#define fct_ts__is_test_mode(ts) ((ts)->mode == ts_mode_test) -#define fct_ts__is_ending_mode(ts) ((ts)->mode == ts_mode_ending) -#define fct_ts__is_end(ts) ((ts)->mode == ts_mode_end) -#define fct_ts__is_cnt_mode(ts) ((ts)->mode == ts_mode_cnt) -#define fct_ts__is_abort_mode(ts) ((ts)->mode == ts_mode_abort) - -/* This cndtn is set when we have iterated through all the tests, and -there was nothing more to do. */ -#define fct_ts__ending(ts) ((ts)->mode = ts_mode_ending) - -/* Flag a test suite as complete. It will no longer accept any more tests. */ -#define fct_ts__end(ts) ((ts)->mode = ts_mode_end) - -#define fct_ts__name(ts) ((ts)->name) - - -static void -fct_ts__del(fct_ts_t *ts) -{ - if ( ts == NULL ) - { - return; - } - fct_nlist__final(&(ts->test_list), (fct_nlist_on_del_t)fct_test__del); - free(ts); -} - -static fct_ts_t * -fct_ts_new(char const *name) -{ - fct_ts_t *ts =NULL; - ts = (fct_ts_t*)calloc(1, sizeof(fct_ts_t)); - FCT_ASSERT( ts != NULL ); - - fctstr_safe_cpy(ts->name, name, FCT_MAX_NAME); - ts->mode = ts_mode_cnt; - fct_nlist__init(&(ts->test_list)); - return ts; -} - - - -static nbool_t -fct_ts__is_more_tests(fct_ts_t const *ts) -{ - FCT_ASSERT( ts != NULL ); - FCT_ASSERT( !fct_ts__is_end(ts) ); - return ts->curr_test_num < ts->total_test_num; -} - - -/* Indicates that we have started a test case. */ -static void -fct_ts__test_begin(fct_ts_t *ts) -{ - FCT_ASSERT( !fct_ts__is_end(ts) ); - ++(ts->curr_test_num); -} - - -/* Takes OWNERSHIP of a test object, and warehouses it for later stat -generation. */ -static void -fct_ts__add_test(fct_ts_t *ts, fct_test_t *test) -{ - FCT_ASSERT( ts != NULL && "invalid arg"); - FCT_ASSERT( test != NULL && "invalid arg"); - FCT_ASSERT( !fct_ts__is_end(ts) ); - fct_nlist__append(&(ts->test_list), test); -} - - -static void -fct_ts__test_end(fct_ts_t *ts) -{ - FCT_ASSERT( ts != NULL ); - /* After a test has completed, move to teardown mode. */ - ts->mode = ts_mode_teardown; -} - - -/* Increments the internal count by 1. */ -static void -fct_ts__inc_total_test_num(fct_ts_t *ts) -{ - FCT_ASSERT( ts != NULL ); - FCT_ASSERT( fct_ts__is_cnt_mode(ts) ); - FCT_ASSERT( !fct_ts__is_end(ts) ); - ++(ts->total_test_num); -} - - -/* Flags the end of the setup, which implies we are going to move into -setup mode. You must be already in setup mode for this to work! */ -static void -fct_ts__setup_end(fct_ts_t *ts) -{ - if ( ts->mode != ts_mode_abort ) - { - ts->mode = ts_mode_test; - } -} - - -static fct_test_t * -fct_ts__make_abort_test(fct_ts_t *ts) -{ - char setup_testname[FCT_MAX_LOG_LINE+1] = {'\0'}; - char const *suitename = fct_ts__name(ts); - fct_snprintf(setup_testname, FCT_MAX_LOG_LINE, "setup_%s", suitename); - return fct_test_new(setup_testname); -} - -/* Flags a pre-mature abort of a setup (like a failed fct_req). */ -static void -fct_ts__setup_abort(fct_ts_t *ts) -{ - FCT_ASSERT( ts != NULL ); - ts->mode = ts_mode_abort; -} - -/* Flags the end of the teardown, which implies we are going to move -into setup mode (for the next 'iteration'). */ -static void -fct_ts__teardown_end(fct_ts_t *ts) -{ - if ( ts->mode == ts_mode_abort ) - { - return; /* Because we are aborting . */ - } - /* We have to decide if we should keep on testing by moving into tear down - mode or if we have reached the real end and should be moving into the - ending mode. */ - if ( fct_ts__is_more_tests(ts) ) - { - ts->mode = ts_mode_setup; - } - else - { - ts->mode = ts_mode_ending; - } -} - - -/* Flags the end of the counting, and proceeding to the first setup. -Consider the special case when a test suite has NO tests in it, in -that case we will have a current count that is zero, in which case -we can skip right to 'ending'. */ -static void -fct_ts__cnt_end(fct_ts_t *ts) -{ - FCT_ASSERT( ts != NULL ); - FCT_ASSERT( fct_ts__is_cnt_mode(ts) ); - FCT_ASSERT( !fct_ts__is_end(ts) ); - if (ts->total_test_num == 0 ) - { - ts->mode = ts_mode_ending; - } - else - { - ts->mode = ts_mode_setup; - } -} - - -static nbool_t -fct_ts__is_test_cnt(fct_ts_t const *ts, int test_num) -{ - FCT_ASSERT( ts != NULL ); - FCT_ASSERT( 0 <= test_num ); - FCT_ASSERT( test_num < ts->total_test_num ); - FCT_ASSERT( !fct_ts__is_end(ts) ); - - /* As we roll through the tests we increment the count. With this - count we can decide if we need to execute a test or not. */ - return test_num == ts->curr_test_num; -} - - -/* Returns the # of tests on the FCT TS object. This is the actual -# of tests executed. */ -static size_t -fct_ts__tst_cnt(fct_ts_t const *ts) -{ - FCT_ASSERT( ts != NULL ); - FCT_ASSERT( - fct_ts__is_end(ts) - && "can't count number of tests executed until the test suite ends" - ); - return fct_nlist__size(&(ts->test_list)); -} - - -/* Returns the # of tests in the TS object that passed. */ -static size_t -fct_ts__tst_cnt_passed(fct_ts_t const *ts) -{ - size_t tally =0; - - FCT_ASSERT( ts != NULL ); - FCT_ASSERT( fct_ts__is_end(ts) ); - - FCT_NLIST_FOREACH_BGN(fct_test_t*, test, &(ts->test_list)) - { - if ( fct_test__is_pass(test) ) - { - tally += 1; - } - } - FCT_NLIST_FOREACH_END(); - return tally; -} - - -/* Returns the # of checks made throughout a test suite. */ -static size_t -fct_ts__chk_cnt(fct_ts_t const *ts) -{ - size_t tally =0; - - FCT_ASSERT( ts != NULL ); - - FCT_NLIST_FOREACH_BGN(fct_test_t *, test, &(ts->test_list)) - { - tally += fct_test__chk_cnt(test); - } - FCT_NLIST_FOREACH_END(); - return tally; -} - -/* Currently the duration is simply a sum of all the tests. */ -static double -fct_ts__duration(fct_ts_t const *ts) -{ - double tally =0.0; - FCT_ASSERT( ts != NULL ); - FCT_NLIST_FOREACH_BGN(fct_test_t *, test, &(ts->test_list)) - { - tally += fct_test__duration(test); - } - FCT_NLIST_FOREACH_END(); - return tally; -} - - -/* --------------------------------------------------------- -FCT COMMAND LINE OPTION INITIALIZATION (fctcl_init) --------------------------------------------------------- - -Structure used for command line initialization. To keep it clear that we do -not delete the char*'s present on this structure. -*/ - - -typedef enum -{ - FCTCL_STORE_UNDEFINED, - FCTCL_STORE_TRUE, - FCTCL_STORE_VALUE -} fctcl_store_t; - - -typedef struct _fctcl_init_t -{ - /* What to parse for this option. --long versus -s. */ - char const *long_opt; /* i.e. --help */ - char const *short_opt; /* i.e. -h */ - - /* What action to take when the option is activated. */ - fctcl_store_t action; - - /* The help string for the action. */ - char const *help; -} fctcl_init_t; - - -/* Use when defining the option list. */ -#define FCTCL_INIT_NULL \ - {NULL, NULL, FCTCL_STORE_UNDEFINED, NULL} - - -/* --------------------------------------------------------- -FCT COMMAND LINE OPTION (fctcl) --------------------------------------------------------- - -Specifies the command line configuration options. Use this -to help initialize the fct_clp (command line parser). -*/ - - -/* Handy strings for storing "true" and "false". We can reference -these strings throughout the parse operation and not have to -worry about dealing with memory. */ -#define FCTCL_TRUE_STR "1" - - -typedef struct _fctcl_t -{ - /* What to parse for this option. --long versus -s. */ - char *long_opt; /* i.e. --help */ - char *short_opt; /* i.e. -h */ - - /* What action to take when the option is activated. */ - fctcl_store_t action; - - /* The help string for the action. */ - char *help; - - /* The result. */ - char *value; -} fctcl_t; - - -#define fctcl_new() ((fctcl_t*)calloc(1, sizeof(fctcl_t))) - - -static void -fctcl__del(fctcl_t *clo) -{ - if ( clo == NULL ) - { - return; - } - if ( clo->long_opt ) - { - free(clo->long_opt); - } - if ( clo->short_opt) - { - free(clo->short_opt); - } - if ( clo->value ) - { - free(clo->value); - } - if ( clo->help ) - { - free(clo->help); - } - free(clo); -} - - -static fctcl_t* -fctcl_new2(fctcl_init_t const *clo_init) -{ - fctcl_t *clone = NULL; - int ok =0; - clone = fctcl_new(); - if ( clone == NULL ) - { - return NULL; - } - clone->action = clo_init->action; - if ( clo_init->help == NULL ) - { - clone->help = NULL; - } - else - { - clone->help = fctstr_clone(clo_init->help); - if ( clone->help == NULL ) - { - ok =0; - goto finally; - } - } - if ( clo_init->long_opt == NULL ) - { - clone->long_opt = NULL; - } - else - { - clone->long_opt = fctstr_clone(clo_init->long_opt); - if ( clone->long_opt == NULL ) - { - ok = 0; - goto finally; - } - } - if ( clo_init->short_opt == NULL ) - { - clone->short_opt = NULL; - } - else - { - clone->short_opt = fctstr_clone(clo_init->short_opt); - if ( clone->short_opt == NULL ) - { - ok =0; - goto finally; - } - } - ok = 1; -finally: - if ( !ok ) - { - fctcl__del(clone); - clone = NULL; - } - return clone; -} - - -static int -fctcl__is_option(fctcl_t const *clo, char const *option) -{ - FCT_ASSERT( clo != NULL ); - if ( option == NULL ) - { - return 0; - } - return ((clo->long_opt != NULL - && fctstr_eq(clo->long_opt, option)) - || - (clo->short_opt != NULL - && fctstr_eq(clo->short_opt, option)) - ); -} - - -#define fctcl__set_value(_CLO_, _VAL_) \ - (_CLO_)->value = fctstr_clone((_VAL_)); - -/* --------------------------------------------------------- -FCT COMMAND PARSER (fct_clp) --------------------------------------------------------- -*/ - -#define FCT_CLP_MAX_ERR_MSG_LEN 256 - -typedef struct _fct_clp_t -{ - /* List of command line options. */ - fct_nlist_t clo_list; - - /* List of parameters (not options). */ - fct_nlist_t param_list; - - char error_msg[FCT_CLP_MAX_ERR_MSG_LEN]; - int is_error; -} fct_clp_t; - - -static void -fct_clp__final(fct_clp_t *clp) -{ - fct_nlist__final(&(clp->clo_list), (fct_nlist_on_del_t)fctcl__del); - fct_nlist__final(&(clp->param_list), (fct_nlist_on_del_t)free); -} - - -/* Add an configuration options. */ -static int -fct_clp__add_options(fct_clp_t *clp, fctcl_init_t const *options) -{ - fctcl_init_t const *pclo =NULL; - int ok; - for ( pclo = options; pclo->action != FCTCL_STORE_UNDEFINED; ++pclo ) - { - fctcl_t *cpy = fctcl_new2(pclo); - if ( cpy == NULL ) - { - ok = 0; - goto finally; - } - fct_nlist__append(&(clp->clo_list), (void*)cpy); - } - ok =1; -finally: - return ok; -} - -/* Returns false if we ran out of memory. */ -static int -fct_clp__init(fct_clp_t *clp, fctcl_init_t const *options) -{ - int ok =0; - FCT_ASSERT( clp != NULL ); - /* It is just much saner to manage a clone of the options. Then we know - who is in charge of the memory. */ - ok = fct_nlist__init(&(clp->clo_list)); - if ( !ok ) - { - goto finally; - } - if ( options != NULL ) - { - ok = fct_clp__add_options(clp, options); - if ( !ok ) - { - goto finally; - } - } - ok = fct_nlist__init(&(clp->param_list)); - if ( !ok ) - { - goto finally; - } - ok =1; -finally: - if ( !ok ) - { - fct_clp__final(clp); - } - return ok; -} - - -/* Parses the command line arguments. Use fct_clp__is_error and -fct_clp__get_error to figure out if something went awry. */ -static void -fct_clp__parse(fct_clp_t *clp, int argc, char const *argv[]) -{ - int argi =1; - int is_option =0; - char *arg =NULL; - char *token =NULL; - char *next_token =NULL; - - clp->error_msg[0] = '\0'; - clp->is_error =0; - - while ( argi < argc ) - { - is_option =0; - token =NULL; - next_token = NULL; - arg = fctstr_clone(argv[argi]); - -#if defined(_MSC_VER) && _MSC_VER > 1300 - token = strtok_s(arg, "=", &next_token); -#else - token = strtok(arg, "="); - next_token = strtok(NULL, "="); -#endif - - FCT_NLIST_FOREACH_BGN(fctcl_t*, pclo, &(clp->clo_list)) - { - /* Need to reset for each search. strtok below is destructive. */ - if ( fctcl__is_option(pclo, token) ) - { - is_option =1; - if ( pclo->action == FCTCL_STORE_VALUE ) - { - /* If this is --xxxx=value then the next strtok should succeed. - Otherwise, we need to chew up the next argument. */ - if ( next_token != NULL && strlen(next_token) > 0 ) - { - fctcl__set_value(pclo, next_token); - } - else - { - ++argi; /* Chew up the next value */ - if ( argi >= argc ) - { - /* error */ - fct_snprintf( - clp->error_msg, - FCT_CLP_MAX_ERR_MSG_LEN, - "missing argument for %s", - token - ); - clp->is_error =1; - break; - } - fctcl__set_value(pclo, argv[argi]); - } - } - else if (pclo->action == FCTCL_STORE_TRUE) - { - fctcl__set_value(pclo, FCTCL_TRUE_STR); - } - else - { - FCT_ASSERT("undefined action requested"); - } - break; /* No need to parse this argument further. */ - } - } - FCT_NLIST_FOREACH_END(); - /* If we have an error, exit. */ - if ( clp->is_error ) - { - break; - } - /* If we walked through all the options, and didn't find - anything, then we must have a parameter. Forget the fact that - an unknown option will be treated like a parameter... */ - if ( !is_option ) - { - fct_nlist__append(&(clp->param_list), arg); - arg =NULL; /* Owned by the nlist */ - } - ++argi; - if ( arg != NULL ) - { - free(arg); - arg =NULL; - } - } -} - - -static fctcl_t const* -fct_clp__get_clo(fct_clp_t const *clp, char const *option) -{ - fctcl_t const *found =NULL; - - FCT_NLIST_FOREACH_BGN(fctcl_t const*, pclo, &(clp->clo_list)) - { - if ( fctcl__is_option(pclo, option) ) - { - found = pclo; - break; - } - } - FCT_NLIST_FOREACH_END(); - return found; -} - - -#define fct_clp__optval(_CLP_, _OPTION_) \ - fct_clp__optval2((_CLP_), (_OPTION_), NULL) - - -/* Returns the value parsed at the command line, and equal to OPTION. -If the value wasn't parsed, the DEFAULT_VAL is returned instead. */ -static char const* -fct_clp__optval2(fct_clp_t *clp, char const *option, char const *default_val) -{ - fctcl_t const *clo =NULL; - FCT_ASSERT( clp != NULL ); - FCT_ASSERT( option != NULL ); - clo = fct_clp__get_clo(clp, option); - if ( clo == NULL || clo->value == NULL) - { - return default_val; - } - return clo->value; -} - - - -/* Mainly used for unit tests. */ -static int -fct_clp__is_param(fct_clp_t *clp, char const *param) -{ - if ( clp == NULL || param == NULL ) - { - return 0; - } - FCT_NLIST_FOREACH_BGN(char *, aparam, &(clp->param_list)) - { - if ( fctstr_eq(aparam, param) ) - { - return 1; - } - } - FCT_NLIST_FOREACH_END(); - return 0; -} - - -#define fct_clp__is_error(_CLP_) ((_CLP_)->is_error) -#define fct_clp__get_error(_CLP_) ((_CLP_)->error_msg); - -#define fct_clp__num_clo(_CLP_) \ - (fct_nlist__size(&((_CLP_)->clo_list))) - -#define fct_clp__param_cnt(_CLP_) \ - (fct_nlist__size(&((_CLP_)->param_list))) - -/* Returns a *reference* to the parameter at _IDX_. Do not modify -its contents. */ -#define fct_clp__param_at(_CLP_, _IDX_) \ - ((char const*)fct_nlist__at(&((_CLP_)->param_list), (_IDX_))) - - -/* Returns true if the given option was on the command line. -Use either the long or short option name to check against. */ -#define fct_clp__is(_CLP_, _OPTION_) \ - (fct_clp__optval((_CLP_), (_OPTION_)) != NULL) - - - -/* --------------------------------------------------------- -FCT NAMESPACE --------------------------------------------------------- - -The macros below start to pollute the watch window with -lots of "system" variables. This NAMESPACE is an -attempt to hide all the "system" variables in one place. -*/ -typedef struct _fct_namespace_t -{ - /* The currently active test suite. */ - fct_ts_t *ts_curr; - int ts_is_skip_suite; - char const *ts_skip_cndtn; - - /* Current test name. */ - char const* curr_test_name; - fct_test_t *curr_test; - const char *test_skip_cndtn; - int test_is_skip; - - /* Counts the number of tests in a test suite. */ - int test_num; - - /* Set at the end of the test suites. */ - size_t num_total_failed; -} fct_namespace_t; - - -static void -fct_namespace_init(fct_namespace_t *ns) -{ - FCT_ASSERT( ns != NULL && "invalid argument!"); - memset(ns, 0, sizeof(fct_namespace_t)); -} - - -/* --------------------------------------------------------- -FCT KERNAL --------------------------------------------------------- - -The "fctkern" is a singleton that is defined throughout the -system. -*/ - -struct _fctkern_t -{ - /* Holds variables used throughout MACRO MAGIC. In order to reduce - the "noise" in the watch window during a debug trace. */ - fct_namespace_t ns; - - /* Command line parsing. */ - fct_clp_t cl_parser; - - /* Hold onto the command line arguments. */ - int cl_argc; - char const **cl_argv; - /* Track user options. */ - fctcl_init_t const *cl_user_opts; - - /* Tracks the delay parsing. */ - int cl_is_parsed; - - /* This is an list of loggers that can be used in the fct system. */ - fct_nlist_t logger_list; - - /* Array of custom types, you have built-in system ones and you - have optionally supplied user ones.. */ - fct_logger_types_t *lt_usr; - fct_logger_types_t *lt_sys; - - /* This is a list of prefix's that can be used to determine if a - test is should be run or not. */ - fct_nlist_t prefix_list; - - /* This is a list of test suites that where generated throughout the - testing process. */ - fct_nlist_t ts_list; - - /* Records what we expect to fail. */ - size_t num_expected_failures; -}; - - -#define FCT_OPT_VERSION "--version" -#define FCT_OPT_VERSION_SHORT "-v" -#define FCT_OPT_HELP "--help" -#define FCT_OPT_HELP_SHORT "-h" -#define FCT_OPT_LOGGER "--logger" -#define FCT_OPT_LOGGER_SHORT "-l" -static fctcl_init_t FCT_CLP_OPTIONS[] = -{ - /* Totally unsafe, since we are assuming we can clean out this data, - what I need to do is have an "initialization" object, full of - const objects. But for now, this should work. */ - { - FCT_OPT_VERSION, - FCT_OPT_VERSION_SHORT, - FCTCL_STORE_TRUE, - "Displays the FCTX version number and exits." - }, - { - FCT_OPT_HELP, - FCT_OPT_HELP_SHORT, - FCTCL_STORE_TRUE, - "Shows this help." - }, - { - FCT_OPT_LOGGER, - FCT_OPT_LOGGER_SHORT, - FCTCL_STORE_VALUE, - NULL - }, - FCTCL_INIT_NULL /* Sentinel */ -}; - -typedef fct_logger_i* (*fct_logger_new_fn)(void); -struct _fct_logger_types_t -{ - char const *name; - fct_logger_new_fn logger_new_fn; - char const *desc; -}; - -static fct_logger_types_t FCT_LOGGER_TYPES[] = -{ - { - "standard", - (fct_logger_new_fn)fct_standard_logger_new, - "the basic fctx logger" - }, - { - "minimal", - (fct_logger_new_fn)fct_minimal_logger_new, - "the least amount of logging information." - }, - { - "junit", - (fct_logger_new_fn)fct_junit_logger_new, - "junit compatable xml" - }, - {NULL, (fct_logger_new_fn)NULL, NULL} /* Sentinel */ -}; - - -/* Returns the number of filters defined for the fct kernal. */ -#define fctkern__filter_cnt(_NK_) (fct_nlist__size(&((_NK_)->prefix_list))) - - -static void -fctkern__add_logger(fctkern_t *nk, fct_logger_i *logger_owns) -{ - FCT_ASSERT(nk != NULL && "invalid arg"); - FCT_ASSERT(logger_owns != NULL && "invalid arg"); - fct_nlist__append(&(nk->logger_list), logger_owns); -} - - -static void -fctkern__write_help(fctkern_t *nk, FILE *out) -{ - fct_clp_t *clp = &(nk->cl_parser); - fprintf(out, "test.exe [options] prefix_filter ...\n\n"); - FCT_NLIST_FOREACH_BGN(fctcl_t*, clo, &(clp->clo_list)) - { - if ( clo->short_opt != NULL ) - { - fprintf(out, "%s, %s\n", clo->short_opt, clo->long_opt); - } - else - { - fprintf(out, "%s\n", clo->long_opt); - } - if ( !fctstr_ieq(clo->long_opt, FCT_OPT_LOGGER) ) - { - /* For now lets not get to fancy with the text wrapping. */ - fprintf(out, " %s\n", clo->help); - } - else - { - fct_logger_types_t *types[2]; - int type_i; - fct_logger_types_t *itr; - types[0] = nk->lt_sys; - types[1] = nk->lt_usr; - fputs(" Sets the logger. The types of loggers currently " - "available are,\n", out); - for (type_i =0; type_i != 2; ++type_i ) - { - for ( itr=types[type_i]; itr && itr->name != NULL; ++itr ) - { - fprintf(out, " =%s : %s\n", itr->name, itr->desc); - } - } - fprintf(out, " default is '%s'.\n", FCT_DEFAULT_LOGGER); - } - } - FCT_NLIST_FOREACH_END(); - fputs("\n", out); -} - - -/* Appends a prefix filter that is used to determine if a test can -be executed or not. If the test starts with the same characters as -the prefix, then it should be "runnable". The prefix filter must be -a non-NULL, non-Blank string. */ -static void -fctkern__add_prefix_filter(fctkern_t *nk, char const *prefix_filter) -{ - char *filter =NULL; - size_t filter_len =0; - FCT_ASSERT( nk != NULL && "invalid arg" ); - FCT_ASSERT( prefix_filter != NULL && "invalid arg" ); - FCT_ASSERT( strlen(prefix_filter) > 0 && "invalid arg" ); - /* First we make a copy of the prefix, then we store it away - in our little list. */ - filter_len = strlen(prefix_filter); - filter = (char*)malloc(sizeof(char)*(filter_len+1)); - fctstr_safe_cpy(filter, prefix_filter, filter_len+1); - fct_nlist__append(&(nk->prefix_list), (void*)filter); -} - - -/* Cleans up the contents of a fctkern. NULL does nothing. */ -static void -fctkern__final(fctkern_t *nk) -{ - if ( nk == NULL ) - { - return; - } - fct_clp__final(&(nk->cl_parser)); - fct_nlist__final(&(nk->logger_list), (fct_nlist_on_del_t)fct_logger__del); - /* The prefix list is a list of malloc'd strings. */ - fct_nlist__final(&(nk->prefix_list), (fct_nlist_on_del_t)free); - fct_nlist__final(&(nk->ts_list), (fct_nlist_on_del_t)fct_ts__del); -} - - -#define fctkern__cl_is_parsed(_NK_) ((_NK_)->cl_is_parsed) - - -static int -fctkern__cl_is(fctkern_t *nk, char const *opt_str) -{ - FCT_ASSERT( opt_str != NULL ); - return opt_str[0] != '\0' - && fct_clp__is(&(nk->cl_parser), opt_str); -} - - -/* Returns the command line value given by OPT_STR. If OPT_STR was not defined -at the command line, DEF_STR is returned (you can use NULL for the DEF_STR). -The result returned should not be mofidied, and MAY even be the same pointer -to DEF_STR. */ -static char const * -fctkern__cl_val2(fctkern_t *nk, char const *opt_str, char const *def_str) -{ - FCT_ASSERT( opt_str != NULL ); - if ( nk == NULL ) - { - return NULL; - } - return fct_clp__optval2(&(nk->cl_parser), opt_str, def_str); -} - - -/* Selects a logger from the list based on the selection name. -May return NULL if the name doesn't exist in the list. */ -static fct_logger_i* -fckern_sel_log(fct_logger_types_t *search, char const *sel_logger) -{ - fct_logger_types_t *iter; - FCT_ASSERT(search != NULL); - FCT_ASSERT(sel_logger != NULL); - FCT_ASSERT(strlen(sel_logger) > 0); - for ( iter = search; iter->name != NULL; ++iter) - { - if ( fctstr_ieq(iter->name, sel_logger) ) - { - return iter->logger_new_fn(); - } - } - return NULL; -} - -static int -fctkern__cl_parse_config_logger(fctkern_t *nk) -{ - fct_logger_i *logger =NULL; - char const *sel_logger =NULL; - char const *def_logger =FCT_DEFAULT_LOGGER; - sel_logger = fctkern__cl_val2(nk, FCT_OPT_LOGGER, def_logger); - FCT_ASSERT(sel_logger != NULL && "should never be NULL"); - /* First search the user selected types, then search the - built-in types. */ - if ( nk->lt_usr != NULL ) - { - logger = fckern_sel_log(nk->lt_usr, sel_logger); - } - if ( nk->lt_sys != NULL && logger == NULL ) - { - logger = fckern_sel_log(nk->lt_sys, sel_logger); - } - if ( logger == NULL ) - { - /* No logger configured, you must have supplied an invalid selection. */ - fprintf(stderr, "error: unknown logger selected - '%s'", sel_logger); - return 0; - } - fctkern__add_logger(nk, logger); - logger = NULL; /* owned by nk. */ - return 1; -} - - - -/* Call this if you want to (re)parse the command line options with a new -set of options. Returns -1 if you are to abort with EXIT_SUCCESS, returns -0 if you are to abort with EXIT_FAILURE and returns 1 if you are to continue. */ -static int -fctkern__cl_parse(fctkern_t *nk) -{ - int status =0; - size_t num_params =0; - size_t param_i =0; - if ( nk == NULL ) - { - return 0; - } - if ( nk->cl_user_opts != NULL ) - { - if ( !fct_clp__add_options(&(nk->cl_parser), nk->cl_user_opts) ) - { - status =0; - goto finally; - } - } - /* You want to add the "house options" after the user defined ones. The - options are stored as a list so it means that any option listed after - the above ones won't get parsed. */ - if ( !fct_clp__add_options(&(nk->cl_parser), FCT_CLP_OPTIONS) ) - { - status =0; - goto finally; - } - fct_clp__parse(&(nk->cl_parser), nk->cl_argc, nk->cl_argv); - if ( fct_clp__is_error(&(nk->cl_parser)) ) - { - char *err = fct_clp__get_error(&(nk->cl_parser)); - fprintf(stderr, "error: %s", err); - status =0; - goto finally; - } - num_params = fct_clp__param_cnt(&(nk->cl_parser)); - for ( param_i =0; param_i != num_params; ++param_i ) - { - char const *param = fct_clp__param_at(&(nk->cl_parser), param_i); - fctkern__add_prefix_filter(nk, param); - } - if ( fctkern__cl_is(nk, FCT_OPT_VERSION) ) - { - (void)printf("Built using FCTX version %s.\n", FCT_VERSION_STR); - status = -1; - goto finally; - } - if ( fctkern__cl_is(nk, FCT_OPT_HELP) ) - { - fctkern__write_help(nk, stdout); - status = -1; - goto finally; - } - if ( !fctkern__cl_parse_config_logger(nk) ) - { - status = -1; - goto finally; - } - status =1; - nk->cl_is_parsed =1; -finally: - return status; -} - - - -/* Parses the command line and sets up the framework. The argc and argv -should be directly from the program's main. */ -static int -fctkern__init(fctkern_t *nk, int argc, const char *argv[]) -{ - if ( argc == 0 && argv == NULL ) - { - return 0; - } - memset(nk, 0, sizeof(fctkern_t)); - fct_clp__init(&(nk->cl_parser), NULL); - fct_nlist__init(&(nk->logger_list)); - nk->lt_usr = NULL; /* Supplied via 'install' mechanics. */ - nk->lt_sys = FCT_LOGGER_TYPES; - fct_nlist__init2(&(nk->prefix_list), 0); - fct_nlist__init2(&(nk->ts_list), 0); - nk->cl_is_parsed =0; - /* Save a copy of the arguments. We do a delay parse of the command - line arguments in order to allow the client code to optionally configure - the command line parser.*/ - nk->cl_argc = argc; - nk->cl_argv = argv; - fct_namespace_init(&(nk->ns)); - return 1; -} - - -/* Takes OWNERSHIP of the test suite after we have finished executing -its contents. This way we can build up all kinds of summaries at the end -of a run. */ -static void -fctkern__add_ts(fctkern_t *nk, fct_ts_t *ts) -{ - FCT_ASSERT( nk != NULL ); - FCT_ASSERT( ts != NULL ); - fct_nlist__append(&(nk->ts_list), ts); -} - - -/* Returns FCT_TRUE if the supplied test_name passes the filters set on -this test suite. If there are no filters, we return FCT_TRUE always. */ -static nbool_t -fctkern__pass_filter(fctkern_t *nk, char const *test_name) -{ - size_t prefix_i =0; - size_t prefix_list_size =0; - FCT_ASSERT( nk != NULL && "invalid arg"); - FCT_ASSERT( test_name != NULL ); - FCT_ASSERT( strlen(test_name) > 0 ); - prefix_list_size = fctkern__filter_cnt(nk); - /* If there is no filter list, then we return FCT_TRUE always. */ - if ( prefix_list_size == 0 ) - { - return FCT_TRUE; - } - /* Iterate through the prefix filter list, and see if we have - anything that does not pass. All we require is ONE item that - passes the test in order for us to succeed here. */ - for ( prefix_i = 0; prefix_i != prefix_list_size; ++prefix_i ) - { - char const *prefix = (char const*)fct_nlist__at( - &(nk->prefix_list), prefix_i - ); - nbool_t pass = fct_filter_pass(prefix, test_name); - if ( pass ) - { - return FCT_TRUE; - } - } - /* Otherwise, we never managed to find a prefix that satisfied the - supplied test name. Therefore we have failed to pass to the filter - list test. */ - return FCT_FALSE; -} - - -/* Returns the number of tests that were performed. */ -static size_t -fctkern__tst_cnt(fctkern_t const *nk) -{ - size_t tally =0; - FCT_ASSERT( nk != NULL ); - FCT_NLIST_FOREACH_BGN(fct_ts_t *, ts, &(nk->ts_list)) - { - tally += fct_ts__tst_cnt(ts); - } - FCT_NLIST_FOREACH_END(); - return tally; -} - - -/* Returns the number of tests that passed. */ -static size_t -fctkern__tst_cnt_passed(fctkern_t const *nk) -{ - size_t tally =0; - FCT_ASSERT( nk != NULL ); - - FCT_NLIST_FOREACH_BGN(fct_ts_t*, ts, &(nk->ts_list)) - { - tally += fct_ts__tst_cnt_passed(ts); - } - FCT_NLIST_FOREACH_END(); - - return tally; -} - - -/* Returns the number of tests that failed. */ -#define fctkern__tst_cnt_failed(nk) \ - (fctkern__tst_cnt(nk) - fctkern__tst_cnt_passed(nk)) - - -/* Returns the number of checks made throughout the entire test. */ -#if defined(FCT_USE_TEST_COUNT) -static size_t -fctkern__chk_cnt(fctkern_t const *nk) -{ - size_t tally =0; - FCT_ASSERT( nk != NULL ); - - FCT_NLIST_FOREACH_BGN(fct_ts_t *, ts, &(nk->ts_list)) - { - tally += fct_ts__chk_cnt(ts); - } - FCT_NLIST_FOREACH_END(); - return tally; -} -#endif /* FCT_USE_TEST_COUNT */ - - -/* Indicates the very end of all the tests. */ -#define fctkern__end(nk) /* unused */ - - -static void -fctkern__log_suite_start(fctkern_t *nk, fct_ts_t const *ts) -{ - FCT_ASSERT( nk != NULL ); - FCT_ASSERT( ts != NULL ); - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &(nk->logger_list)) - { - fct_logger__on_test_suite_start(logger, ts); - } - FCT_NLIST_FOREACH_END(); -} - - -static void -fctkern__log_suite_end(fctkern_t *nk, fct_ts_t const *ts) -{ - FCT_ASSERT( nk != NULL ); - FCT_ASSERT( ts != NULL ); - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &(nk->logger_list)) - { - fct_logger__on_test_suite_end(logger, ts); - } - FCT_NLIST_FOREACH_END(); -} - - -static void -fctkern__log_suite_skip(fctkern_t *nk, char const *condition, char const *name) -{ - if ( nk == NULL ) - { - return; - } - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &(nk->logger_list)) - { - fct_logger__on_test_suite_skip(logger, condition, name); - } - FCT_NLIST_FOREACH_END(); -} - - -static void -fctkern__log_test_skip(fctkern_t *nk, char const *condition, char const *name) -{ - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &(nk->logger_list)) - { - fct_logger__on_test_skip(logger, condition, name); - } - FCT_NLIST_FOREACH_END(); -} - - -/* Use this for displaying information about a "Check" (i.e. -a condition). */ -static void -fctkern__log_chk(fctkern_t *nk, fctchk_t const *chk) -{ - FCT_ASSERT( nk != NULL ); - FCT_ASSERT( chk != NULL ); - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &(nk->logger_list)) - { - fct_logger__on_chk(logger, chk); - } - FCT_NLIST_FOREACH_END(); -} - - -/* Use this for displaying warning messages. */ -static void -fctkern__log_warn(fctkern_t *nk, char const *warn) -{ - FCT_ASSERT( nk != NULL ); - FCT_ASSERT( warn != NULL ); - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &(nk->logger_list)) - { - fct_logger__on_warn(logger, warn); - } - FCT_NLIST_FOREACH_END(); -} - - -/* Called whenever a test is started. */ -static void -fctkern__log_test_start(fctkern_t *nk, fct_test_t const *test) -{ - FCT_ASSERT( nk != NULL ); - FCT_ASSERT( test != NULL ); - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &(nk->logger_list)) - { - fct_logger__on_test_start(logger, test); - } - FCT_NLIST_FOREACH_END(); -} - - -static void -fctkern__log_test_end(fctkern_t *nk, fct_test_t *test) -{ - FCT_ASSERT( nk != NULL ); - FCT_ASSERT( test != NULL ); - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &(nk->logger_list)) - { - fct_logger__on_test_end(logger, test); - } - FCT_NLIST_FOREACH_END(); -} - - -#define fctkern__log_start(_NK_) \ - {\ - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &((_NK_)->logger_list))\ - {\ - fct_logger__on_fctx_start(logger, (_NK_));\ - }\ - FCT_NLIST_FOREACH_END();\ - } - - -#define fctkern__log_end(_NK_) \ - {\ - FCT_NLIST_FOREACH_BGN(fct_logger_i*, logger, &((_NK_)->logger_list))\ - {\ - fct_logger__on_fctx_end(logger, (_NK_));\ - }\ - FCT_NLIST_FOREACH_END();\ - } - - - - -/* ------------------------------------------------------------ -LOGGER INTERFACE - -Defines an interface to a logging system. A logger -must define the following functions in order to hook -into the logging system. - -See the "Standard Logger" and "Minimal Logger" as examples -of the implementation. ------------------------------------------------------------ -*/ - -/* Common event argument. The values of the each event may or may not be -defined depending on the event in question. */ -struct _fct_logger_evt_t -{ - fctkern_t const *kern; - fctchk_t const *chk; - fct_test_t const *test; - fct_ts_t const *ts; - char const *msg; - char const *cndtn; - char const *name; -}; - - -typedef struct _fct_logger_i_vtable_t -{ - /* 1 - * Fired when an "fct_chk*" (check) function is completed. The event - * will contain a reference to the "chk" object created. - * */ - void (*on_chk)(fct_logger_i *logger, fct_logger_evt_t const *e); - - /* 2 - * Fired when a test starts and before any checks are made. The - * event will have its "test" object set. */ - void (*on_test_start)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* 3 */ - void (*on_test_end)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* 4 */ - void (*on_test_suite_start)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* 5 */ - void (*on_test_suite_end)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* 6 */ - void (*on_fctx_start)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* 7 */ - void (*on_fctx_end)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* 8 - Called when the logger object must "clean up". */ - void (*on_delete)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* 9 */ - void (*on_warn)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* -- new in 1.2 -- */ - /* 10 */ - void (*on_test_suite_skip)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); - /* 11 */ - void (*on_test_skip)( - fct_logger_i *logger, - fct_logger_evt_t const *e - ); -} fct_logger_i_vtable_t; - -#define _fct_logger_head \ - fct_logger_i_vtable_t vtable; \ - fct_logger_evt_t evt - -struct _fct_logger_i -{ - _fct_logger_head; -}; - - -static void -fct_logger__stub(fct_logger_i *l, fct_logger_evt_t const *e) -{ - fct_unused(l); - fct_unused(e); -} - - -static fct_logger_i_vtable_t fct_logger_default_vtable = -{ - fct_logger__stub, /* 1. on_chk */ - fct_logger__stub, /* 2. on_test_start */ - fct_logger__stub, /* 3. on_test_end */ - fct_logger__stub, /* 4. on_test_suite_start */ - fct_logger__stub, /* 5. on_test_suite_end */ - fct_logger__stub, /* 6. on_fctx_start */ - fct_logger__stub, /* 7. on_fctx_end */ - fct_logger__stub, /* 8. on_delete */ - fct_logger__stub, /* 9. on_warn */ - fct_logger__stub, /* 10. on_test_suite_skip */ - fct_logger__stub, /* 11. on_test_skip */ -}; - - -/* Initializes the elements of a logger interface so they are at their -standard values. */ -static void -fct_logger__init(fct_logger_i *logger) -{ - FCT_ASSERT( logger != NULL ); - memcpy( - &(logger->vtable), - &fct_logger_default_vtable, - sizeof(fct_logger_i_vtable_t) - ); - memset(&(logger->evt),0, sizeof(fct_logger_evt_t)); -} - -static void -fct_logger__del(fct_logger_i *logger) -{ - if ( logger ) - { - logger->vtable.on_delete(logger, &(logger->evt)); - } -} - - -static void -fct_logger__on_test_start(fct_logger_i *logger, fct_test_t const *test) -{ - logger->evt.test = test; - logger->vtable.on_test_start(logger, &(logger->evt)); -} - - -static void -fct_logger__on_test_end(fct_logger_i *logger, fct_test_t *test) -{ - logger->evt.test = test; - logger->vtable.on_test_end(logger, &(logger->evt)); -} - - -static void -fct_logger__on_test_suite_start(fct_logger_i *logger, fct_ts_t const *ts) -{ - logger->evt.ts = ts; - logger->vtable.on_test_suite_start(logger, &(logger->evt)); -} - - -static void -fct_logger__on_test_suite_end(fct_logger_i *logger, fct_ts_t const *ts) -{ - logger->evt.ts = ts; - logger->vtable.on_test_suite_end(logger, &(logger->evt)); -} - - -static void -fct_logger__on_test_suite_skip( - fct_logger_i *logger, - char const *condition, - char const *name -) -{ - logger->evt.cndtn = condition; - logger->evt.name = name; - logger->vtable.on_test_suite_skip(logger, &(logger->evt)); -} - - -static void -fct_logger__on_test_skip( - fct_logger_i *logger, - char const *condition, - char const *name -) -{ - logger->evt.cndtn = condition; - logger->evt.name = name; - logger->vtable.on_test_skip(logger, &(logger->evt)); -} - - -static void -fct_logger__on_chk(fct_logger_i *logger, fctchk_t const *chk) -{ - logger->evt.chk = chk; - logger->vtable.on_chk(logger, &(logger->evt)); -} - -/* When we start all our tests. */ -#define fct_logger__on_fctx_start(LOGGER, KERN) \ - (LOGGER)->evt.kern = (KERN);\ - (LOGGER)->vtable.on_fctx_start((LOGGER), &((LOGGER)->evt)); - - -/* When we have reached the end of ALL of our testing. */ -#define fct_logger__on_fctx_end(LOGGER, KERN) \ - (LOGGER)->evt.kern = (KERN);\ - (LOGGER)->vtable.on_fctx_end((LOGGER), &((LOGGER)->evt)); - - -static void -fct_logger__on_warn(fct_logger_i *logger, char const *msg) -{ - logger->evt.msg = msg; - logger->vtable.on_warn(logger, &(logger->evt)); -} - - -/* Commmon routine to record strings representing failures. The -chk should be a failure before we call this, and the list is a list -of char*'s that will eventually be free'd by the logger. */ -static void -fct_logger_record_failure(fctchk_t const* chk, fct_nlist_t* fail_list) -{ - /* For now we will truncate the string to some set amount, later - we can work out a dynamic string object. */ - char *str = (char*)malloc(sizeof(char)*FCT_MAX_LOG_LINE); - FCT_ASSERT( str != NULL ); - fct_snprintf( - str, - FCT_MAX_LOG_LINE, - "%s(%d):\n %s", - fctchk__file(chk), - fctchk__lineno(chk), - fctchk__msg(chk) - ); - /* Append it to the listing ... */ - fct_nlist__append(fail_list, (void*)str); -} - - -/* Another common routine, to print the failures at the end of a run. */ -static void -fct_logger_print_failures(fct_nlist_t const *fail_list) -{ - puts( - "\n----------------------------------------------------------------------------\n" - ); - puts("FAILED TESTS\n\n"); - FCT_NLIST_FOREACH_BGN(char *, cndtn_str, fail_list) - { - printf("%s\n", cndtn_str); - } - FCT_NLIST_FOREACH_END(); - - puts("\n"); -} - - - - -/* ------------------------------------------------------------ -MINIMAL LOGGER ------------------------------------------------------------ - -At the moment the MINIMAL LOGGER is currently disabled. Hope -to bring it back online soon. The only reason it is -disabled is that we don't currently have the ability to specify -loggers. -*/ - - -/* Minimal logger, reports the minimum amount of information needed -to determine "something is happening". */ -struct _fct_minimal_logger_t -{ - _fct_logger_head; - /* A list of char*'s that needs to be cleaned up. */ - fct_nlist_t failed_cndtns_list; -}; - - -static void -fct_minimal_logger__on_chk( - fct_logger_i *self_, - fct_logger_evt_t const *e -) -{ - fct_minimal_logger_t *self = (fct_minimal_logger_t*)self_; - if ( fctchk__is_pass(e->chk) ) - { - fputs(".", stdout); - } - else - { - fputs("x", stdout); - fct_logger_record_failure(e->chk, &(self->failed_cndtns_list)); - - } -} - -static void -fct_minimal_logger__on_fctx_end( - fct_logger_i *self_, - fct_logger_evt_t const *e -) -{ - fct_minimal_logger_t *self = (fct_minimal_logger_t*)self_; - fct_unused(e); - if ( fct_nlist__size(&(self->failed_cndtns_list)) >0 ) - { - fct_logger_print_failures(&(self->failed_cndtns_list)); - } -} - - -static void -fct_minimal_logger__on_delete( - fct_logger_i *self_, - fct_logger_evt_t const *e -) -{ - fct_minimal_logger_t *self = (fct_minimal_logger_t*)self_; - fct_unused(e); - fct_nlist__final(&(self->failed_cndtns_list), free); - free(self); - -} - - -fct_logger_i* -fct_minimal_logger_new(void) -{ - fct_minimal_logger_t *self = (fct_minimal_logger_t*)\ - calloc(1,sizeof(fct_minimal_logger_t)); - if ( self == NULL ) - { - return NULL; - } - fct_logger__init((fct_logger_i*)self); - self->vtable.on_chk = fct_minimal_logger__on_chk; - self->vtable.on_fctx_end = fct_minimal_logger__on_fctx_end; - self->vtable.on_delete = fct_minimal_logger__on_delete; - fct_nlist__init2(&(self->failed_cndtns_list), 0); - return (fct_logger_i*)self; -} - - -/* ------------------------------------------------------------ -STANDARD LOGGER ------------------------------------------------------------ -*/ - -struct _fct_standard_logger_t -{ - _fct_logger_head; - - /* Start time. For now we use the low-accuracy time_t version. */ - fct_timer_t timer; - - /* A list of char*'s that needs to be cleaned up. */ - fct_nlist_t failed_cndtns_list; -}; - - -#define FCT_STANDARD_LOGGER_MAX_LINE 68 - - -/* When a failure occurrs, we will record the details so we can display -them when the log "finishes" up. */ -static void -fct_standard_logger__on_chk( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_standard_logger_t *logger = (fct_standard_logger_t*)logger_; - /* Only record failures. */ - if ( !fctchk__is_pass(e->chk) ) - { - fct_logger_record_failure(e->chk, &(logger->failed_cndtns_list)); - } -} - - -static void -fct_standard_logger__on_test_skip( - fct_logger_i* logger_, - fct_logger_evt_t const *e -) -{ - char const *condition = e->cndtn; - char const *name = e->name; - char msg[256] = {'\0'}; - fct_unused(logger_); - fct_unused(condition); - fct_snprintf(msg, sizeof(msg), "%s (%s)", name, condition); - msg[sizeof(msg)-1] = '\0'; - fct_dotted_line_start(FCT_STANDARD_LOGGER_MAX_LINE, msg); - fct_dotted_line_end("- SKIP -"); -} - - -static void -fct_standard_logger__on_test_start( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_unused(logger_); - fct_dotted_line_start( - FCT_STANDARD_LOGGER_MAX_LINE, - fct_test__name(e->test) - ); -} - - -static void -fct_standard_logger__on_test_end( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - nbool_t is_pass; - fct_unused(logger_); - is_pass = fct_test__is_pass(e->test); - fct_dotted_line_end((is_pass) ? "PASS" : "FAIL ***" ); -} - - -static void -fct_standard_logger__on_fctx_start( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_standard_logger_t *logger = (fct_standard_logger_t*)logger_; - fct_unused(e); - fct_timer__start(&(logger->timer)); -} - - -static void -fct_standard_logger__on_fctx_end( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_standard_logger_t *logger = (fct_standard_logger_t*)logger_; - nbool_t is_success =1; - double elasped_time =0; - size_t num_tests =0; - size_t num_passed =0; - - fct_timer__stop(&(logger->timer)); - - is_success = fct_nlist__size(&(logger->failed_cndtns_list)) ==0; - - if ( !is_success ) - { - fct_logger_print_failures(&(logger->failed_cndtns_list)); - } - puts( - "\n----------------------------------------------------------------------------\n" - ); - num_tests = fctkern__tst_cnt(e->kern); - num_passed = fctkern__tst_cnt_passed(e->kern); - printf( - "%s (%lu/%lu tests", - (is_success) ? "PASSED" : "FAILED", - (unsigned long) num_passed, - (unsigned long) num_tests - ); - elasped_time = fct_timer__duration(&(logger->timer)); - if ( elasped_time > 0.0000001 ) - { - printf(" in %.6fs)\n", elasped_time); - } - else - { - /* Don't bother displaying the time to execute. */ - puts(")\n"); - } -} - - -static void -fct_standard_logger__on_delete( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_standard_logger_t *logger = (fct_standard_logger_t*)logger_; - fct_unused(e); - fct_nlist__final(&(logger->failed_cndtns_list), free); - free(logger); - logger_ =NULL; -} - - -static void -fct_standard_logger__on_warn( - fct_logger_i* logger_, - fct_logger_evt_t const *e -) -{ - fct_unused(logger_); - (void)printf("WARNING: %s", e->msg); -} - - -fct_logger_i* -fct_standard_logger_new(void) -{ - fct_standard_logger_t *logger = (fct_standard_logger_t *)calloc( - 1, sizeof(fct_standard_logger_t) - ); - if ( logger == NULL ) - { - return NULL; - } - fct_logger__init((fct_logger_i*)logger); - logger->vtable.on_chk = fct_standard_logger__on_chk; - logger->vtable.on_test_start = fct_standard_logger__on_test_start; - logger->vtable.on_test_end = fct_standard_logger__on_test_end; - logger->vtable.on_fctx_start = fct_standard_logger__on_fctx_start; - logger->vtable.on_fctx_end = fct_standard_logger__on_fctx_end; - logger->vtable.on_delete = fct_standard_logger__on_delete; - logger->vtable.on_warn = fct_standard_logger__on_warn; - logger->vtable.on_test_skip = fct_standard_logger__on_test_skip; - fct_nlist__init2(&(logger->failed_cndtns_list), 0); - fct_timer__init(&(logger->timer)); - return (fct_logger_i*)logger; -} - - -/* ------------------------------------------------------------ -JUNIT LOGGER ------------------------------------------------------------ -*/ - - -/* JUnit logger */ -struct _fct_junit_logger_t -{ - _fct_logger_head; -}; - - -static void -fct_junit_logger__on_test_suite_start( - fct_logger_i *l, - fct_logger_evt_t const *e -) -{ - fct_unused(l); - fct_unused(e); - FCT_SWITCH_STDOUT_TO_BUFFER(); - FCT_SWITCH_STDERR_TO_BUFFER(); -} - - -static void -fct_junit_logger__on_test_suite_end( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_ts_t const *ts = e->ts; /* Test Suite */ - nbool_t is_pass; - double elasped_time = 0; - char std_buffer[1024]; - int read_length; - int first_out_line; - - fct_unused(logger_); - - elasped_time = fct_ts__duration(ts); - - FCT_SWITCH_STDOUT_TO_STDOUT(); - FCT_SWITCH_STDERR_TO_STDERR(); - - /* opening testsuite tag */ - printf("\t\n", - (unsigned long) fct_ts__tst_cnt(ts) - - fct_ts__tst_cnt_passed(ts), - (unsigned long) fct_ts__tst_cnt(ts), - fct_ts__name(ts), - elasped_time); - - FCT_NLIST_FOREACH_BGN(fct_test_t*, test, &(ts->test_list)) - { - is_pass = fct_test__is_pass(test); - - /* opening testcase tag */ - if (is_pass) - { - printf("\t\t\n", - fct_test__name(test), - fct_test__duration(test) - ); - } - - FCT_NLIST_FOREACH_BGN(fctchk_t*, chk, &(test->failed_chks)) - { - /* error tag */ - printf("\t\t\t", chk->msg); - printf("file:%s, line:%d", chk->file, chk->lineno); - printf("\n"); - } - FCT_NLIST_FOREACH_END(); - - /* closing testcase tag */ - if (is_pass) - { - printf(" />\n"); - } - else - { - printf("\t\t\n"); - } - } - FCT_NLIST_FOREACH_END(); - - /* print the std streams */ - first_out_line = 1; - printf("\t\t\n\t\t\t 0) - { - if (first_out_line) - { - printf("\n"); - first_out_line = 0; - } - printf("%.*s", read_length, std_buffer); - } - printf("]]>\n\t\t\n"); - - first_out_line = 1; - printf("\t\t\n\t\t\t 0) - { - if (first_out_line) - { - printf("\n"); - first_out_line = 0; - } - printf("%.*s", read_length, std_buffer); - } - printf("]]>\n\t\t\n"); - - /* closing testsuite tag */ - printf("\t\n"); -} - -static void -fct_junit_logger__on_fct_start( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_unused(logger_); - fct_unused(e); - printf("\n"); - printf("\n"); -} - -static void -fct_junit_logger__on_fctx_end( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_unused(logger_); - fct_unused(e); - printf("\n"); -} - -static void -fct_junit_logger__on_delete( - fct_logger_i *logger_, - fct_logger_evt_t const *e -) -{ - fct_junit_logger_t *logger = (fct_junit_logger_t*)logger_; - fct_unused(e); - free(logger); - logger_ =NULL; -} - - -fct_junit_logger_t * -fct_junit_logger_new(void) -{ - fct_junit_logger_t *logger = - (fct_junit_logger_t *)calloc(1, sizeof(fct_junit_logger_t)); - if ( logger == NULL ) - { - return NULL; - } - fct_logger__init((fct_logger_i*)logger); - logger->vtable.on_test_suite_start = fct_junit_logger__on_test_suite_start; - logger->vtable.on_test_suite_end = fct_junit_logger__on_test_suite_end; - logger->vtable.on_fctx_start = fct_junit_logger__on_fct_start; - logger->vtable.on_fctx_end = fct_junit_logger__on_fctx_end; - logger->vtable.on_delete = fct_junit_logger__on_delete; - return logger; -} - - -/* ------------------------------------------------------------- -MACRO MAGIC ------------------------------------------------------------- -This is where the show begins! -*/ - -/* This macro invokes a bunch of functions that need to be referenced in -order to avoid a "unreferenced local function has been removed" warning. -The logical acrobatics below try and make it appear to the compiler that -they are needed, but at runtime, only the cheap, first call is made. */ -#define FCT_REFERENCE_FUNCS() \ - {\ - int check = 0 && fctstr_ieq(NULL, NULL);\ - if ( check ) {\ - _fct_cmt("not to be executed");\ - (void)_fct_chk_empty_str(NULL);\ - (void)_fct_chk_full_str(NULL);\ - (void)fct_test__start_timer(NULL);\ - (void)fct_test__stop_timer(NULL);\ - (void)fct_ts_new(NULL);\ - (void)fct_ts__test_begin(NULL);\ - (void)fct_ts__add_test(NULL, NULL);\ - (void)fct_ts__test_end(NULL);\ - (void)fct_ts__inc_total_test_num(NULL);\ - (void)fct_ts__make_abort_test(NULL);\ - (void)fct_ts__setup_abort(NULL);\ - (void)fct_ts__setup_end(NULL);\ - (void)fct_ts__teardown_end(NULL);\ - (void)fct_ts__cnt_end(NULL);\ - (void)fct_ts__is_test_cnt(NULL, 0);\ - (void)fct_xchk_fn(0, "");\ - (void)fct_xchk2_fn(NULL, 0, "");\ - (void)fctkern__cl_parse(NULL);\ - (void)fctkern__add_ts(NULL, NULL);\ - (void)fctkern__pass_filter(NULL, NULL);\ - (void)fctkern__log_suite_start(NULL, NULL);\ - (void)fctkern__log_suite_end(NULL, NULL);\ - (void)fctkern__log_test_skip(NULL, NULL, NULL);\ - (void)fctkern__log_test_start(NULL, NULL);\ - (void)fctkern__log_test_end(NULL, NULL);\ - (void)fctstr_endswith(NULL,NULL);\ - (void)fctstr_iendswith(NULL,NULL);\ - (void)fctstr_ieq(NULL,NULL);\ - (void)fctstr_incl(NULL, NULL);\ - (void)fctstr_iincl(NULL, NULL);\ - (void)fctstr_iendswith(NULL,NULL);\ - (void)fctstr_istartswith(NULL,NULL);\ - (void)fctstr_clone_lower(NULL);\ - (void)fctstr_startswith(NULL,NULL);\ - (void)fctkern__init(NULL, 0, NULL);\ - (void)fctkern__cl_is(NULL, "");\ - (void)fctkern__cl_val2(NULL, NULL, NULL);\ - fctkern__log_suite_skip(NULL, NULL, NULL);\ - (void)fct_clp__is_param(NULL,NULL);\ - _fct_cmt("should never construct an object");\ - (void)fct_test_new(NULL);\ - (void)fct_ts__chk_cnt(NULL);\ - }\ - } - - -#define FCT_INIT(_ARGC_, _ARGV_) \ - fctkern_t fctkern__; \ - fctkern_t* fctkern_ptr__ = &fctkern__; \ - FCT_REFERENCE_FUNCS(); \ - if ( !fctkern__init(fctkern_ptr__, argc, (const char **)argv) ) {\ - (void)fprintf( \ - stderr, "FATAL ERROR: Unable to initialize FCTX Kernel."\ - ); \ - exit(EXIT_FAILURE); \ - } \ - - -#define FCT_FINAL() \ - fctkern_ptr__->ns.num_total_failed = fctkern__tst_cnt_failed( \ - (fctkern_ptr__) \ - ); \ - fctkern__log_end(fctkern_ptr__); \ - fctkern__end(fctkern_ptr__); \ - fctkern__final(fctkern_ptr__); \ - FCT_ASSERT( !((int)fctkern_ptr__->ns.num_total_failed < 0) \ - && "or we got truncated!"); \ - if ( fctkern_ptr__->ns.num_total_failed == \ - fctkern_ptr__->num_expected_failures) { \ - fctkern_ptr__->ns.num_total_failed = 0; \ - } \ - - - -#define FCT_NUM_FAILED() \ - fctkern_ptr__->ns.num_total_failed \ - - - -/* Typically used internally only, this mentions to FCTX that you EXPECT -to _NUM_FAILS_. If you the expected matches the actual, a 0 value is returned -from the program. */ -#define FCT_EXPECTED_FAILURES(_NUM_FAILS_) \ - ((fctkern_ptr__->num_expected_failures = (_NUM_FAILS_))) - - -#define FCT_BGN_FN(_FNNAME_) \ - int _FNNAME_(int argc, char* argv[])\ - { \ - FCT_INIT(argc, argv) - -#define FCT_END_FN() FCT_END() - -/* This defines our start. The fctkern__ is a kernal object -that lives throughout the lifetime of our program. The -fctkern_ptr__ makes it easier to abstract out macros. */ -#define FCT_BGN() FCT_BGN_FN(main) - - -/* Silence Intel complaints about unspecified operand order in user's code */ -#ifndef __INTEL_COMPILER -# define FCT_END_WARNINGFIX_BGN -# define FCT_END_WARNINGFIX_END -#else -# define FCT_END_WARNINGFIX_BGN _Pragma("warning(push,disable:981)"); -# define FCT_END_WARNINGFIX_END _Pragma("warning(pop)"); -#endif - -/* Ends the test suite by returning the number failed. The "chk_cnt" call is -made in order allow strict compilers to pass when it encounters unreferenced -functions. */ -#define FCT_END() \ - { \ - FCT_END_WARNINGFIX_BGN \ - FCT_FINAL(); \ - return FCT_NUM_FAILED();\ - FCT_END_WARNINGFIX_END \ - }\ -} - -#define fctlog_install(_CUST_LOGGER_LIST_) \ - fctkern_ptr__->lt_usr = (_CUST_LOGGER_LIST_) - -/* Re-parses the command line options with the addition of user defined -options. */ -#define fctcl_install(_CLO_INIT_) \ - {\ - fctkern_ptr__->cl_user_opts = (_CLO_INIT_);\ - _fct_cmt("Delay parse in order to allow for user customization.");\ - if ( !fctkern__cl_is_parsed((fctkern_ptr__)) ) {\ - int status = fctkern__cl_parse((fctkern_ptr__));\ - _fct_cmt("Need to parse command line before we start logger.");\ - fctkern__log_start((fctkern_ptr__));\ - switch( status ) {\ - case -1:\ - case 0:\ - fctkern__final(fctkern_ptr__);\ - exit( (status == 0) ? (EXIT_FAILURE) : (EXIT_SUCCESS) );\ - break;\ - default:\ - fct_pass();\ - }\ - }\ - } - - -#define fctcl_is(_OPT_STR_) (fctkern__cl_is(fctkern_ptr__, (_OPT_STR_))) - -#define fctcl_val(_OPT_STR_) (fctcl_val2((_OPT_STR_), NULL)) - -#define fctcl_val2(_OPT_STR_, _DEF_STR_) \ - (fctkern__cl_val2(fctkern_ptr__, (_OPT_STR_), (_DEF_STR_))) - - -/* We delay the first parse of the command line until we get the first -test fixture. This allows the user to possibly add their own parse -specification. */ -#define FCT_FIXTURE_SUITE_BGN(_NAME_) \ - {\ - fctkern_ptr__->ns.ts_curr = fct_ts_new( #_NAME_ );\ - _fct_cmt("Delay parse in order to allow for user customization.");\ - if ( !fctkern__cl_is_parsed((fctkern_ptr__)) ) {\ - int status = fctkern__cl_parse((fctkern_ptr__));\ - _fct_cmt("Need to parse command line before we start logger.");\ - fctkern__log_start((fctkern_ptr__));\ - switch( status ) {\ - case -1:\ - case 0:\ - fct_ts__del((fctkern_ptr__->ns.ts_curr));\ - fctkern__final(fctkern_ptr__);\ - exit( (status == 0) ? (EXIT_FAILURE) : (EXIT_SUCCESS) );\ - break;\ - default:\ - fct_pass();\ - }\ - }\ - if ( fctkern_ptr__->ns.ts_curr == NULL ) {\ - fctkern__log_warn((fctkern_ptr__), "out of memory");\ - }\ - else\ - {\ - fctkern__log_suite_start((fctkern_ptr__), fctkern_ptr__->ns.ts_curr);\ - for (;;)\ - {\ - fctkern_ptr__->ns.test_num = -1;\ - if ( fct_ts__is_ending_mode(fctkern_ptr__->ns.ts_curr) \ - || fct_ts__is_abort_mode(fctkern_ptr__->ns.ts_curr) )\ - {\ - _fct_cmt("flag the test suite as complete.");\ - fct_ts__end(fctkern_ptr__->ns.ts_curr);\ - break;\ - } - - - -/* Closes off a "Fixture" test suite. */ -#define FCT_FIXTURE_SUITE_END() \ - if ( fct_ts__is_cnt_mode(fctkern_ptr__->ns.ts_curr) )\ - {\ - fct_ts__cnt_end(fctkern_ptr__->ns.ts_curr);\ - }\ - }\ - fctkern__add_ts((fctkern_ptr__), fctkern_ptr__->ns.ts_curr);\ - fctkern__log_suite_end((fctkern_ptr__), fctkern_ptr__->ns.ts_curr);\ - fct_ts__end(fctkern_ptr__->ns.ts_curr);\ - fctkern_ptr__->ns.ts_curr = NULL;\ - }\ - } - -#define FCT_FIXTURE_SUITE_BGN_IF(_CONDITION_, _NAME_) \ - fctkern_ptr__->ns.ts_is_skip_suite = !(_CONDITION_);\ - fctkern_ptr__->ns.ts_skip_cndtn = #_CONDITION_;\ - if ( fctkern_ptr__->ns.ts_is_skip_suite ) {\ - fctkern__log_suite_skip((fctkern_ptr__), #_CONDITION_, #_NAME_);\ - }\ - FCT_FIXTURE_SUITE_BGN(_NAME_); - -#define FCT_FIXTURE_SUITE_END_IF() \ - FCT_FIXTURE_SUITE_END();\ - fctkern_ptr__->ns.ts_is_skip_suite =0;\ - fctkern_ptr__->ns.ts_skip_cndtn =NULL;\ - -#define FCT_SETUP_BGN()\ - if ( fct_ts__is_setup_mode(fctkern_ptr__->ns.ts_curr) ) { - -#define FCT_SETUP_END() \ - fct_ts__setup_end(fctkern_ptr__->ns.ts_curr); } - -#define FCT_TEARDOWN_BGN() \ - if ( fct_ts__is_teardown_mode(fctkern_ptr__->ns.ts_curr) ) {\ - -#define FCT_TEARDOWN_END() \ - fct_ts__teardown_end(fctkern_ptr__->ns.ts_curr); \ - continue; \ - } - -/* Lets you create a test suite, where maybe you don't want a fixture. We -do it by 'stubbing' out the setup/teardown logic. */ -#define FCT_SUITE_BGN(Name) \ - FCT_FIXTURE_SUITE_BGN(Name) {\ - FCT_SETUP_BGN() {_fct_cmt("stubbed"); } FCT_SETUP_END()\ - FCT_TEARDOWN_BGN() {_fct_cmt("stubbed");} FCT_TEARDOWN_END()\ - -#define FCT_SUITE_END() } FCT_FIXTURE_SUITE_END() - -#define FCT_SUITE_BGN_IF(_CONDITION_, _NAME_) \ - FCT_FIXTURE_SUITE_BGN_IF(_CONDITION_, (_NAME_)) {\ - FCT_SETUP_BGN() {_fct_cmt("stubbed"); } FCT_SETUP_END()\ - FCT_TEARDOWN_BGN() {_fct_cmt("stubbed");} FCT_TEARDOWN_END()\ - -#define FCT_SUITE_END_IF() } FCT_FIXTURE_SUITE_END_IF() - -typedef enum -{ - FCT_TEST_END_FLAG_Default = 0x0000, - FCT_TEST_END_FLAG_ClearFail = 0x0001 -} FCT_TEST_END_FLAG; - - -#define FCT_TEST_BGN_IF(_CONDITION_, _NAME_) { \ - fctkern_ptr__->ns.test_is_skip = !(_CONDITION_);\ - fctkern_ptr__->ns.test_skip_cndtn = #_CONDITION_;\ - FCT_TEST_BGN(_NAME_) {\ - -#define FCT_TEST_END_IF() \ - } FCT_TEST_END();\ - fctkern_ptr__->ns.test_is_skip = 0;\ - fctkern_ptr__->ns.test_skip_cndtn = NULL;\ - } - - -/* Depending on whether or not we are counting the tests, we will have to -first determine if the test is the "current" count. Then we have to determine -if we can pass the filter. Finally we will execute everything so that when a -check fails, we can "break" out to the end of the test. And in between all -that we do a memory check and fail a test if we can't build a fct_test -object (should be rare). */ -#define FCT_TEST_BGN(_NAME_) \ - {\ - fctkern_ptr__->ns.curr_test_name = #_NAME_;\ - ++(fctkern_ptr__->ns.test_num);\ - if ( fct_ts__is_cnt_mode(fctkern_ptr__->ns.ts_curr) )\ - {\ - fct_ts__inc_total_test_num(fctkern_ptr__->ns.ts_curr);\ - }\ - else if ( fct_ts__is_test_mode(fctkern_ptr__->ns.ts_curr) \ - && fct_ts__is_test_cnt(fctkern_ptr__->ns.ts_curr, fctkern_ptr__->ns.test_num) )\ - {\ - fct_ts__test_begin(fctkern_ptr__->ns.ts_curr);\ - if ( fctkern__pass_filter(fctkern_ptr__, fctkern_ptr__->ns.curr_test_name ) )\ - {\ - fctkern_ptr__->ns.curr_test = fct_test_new( fctkern_ptr__->ns.curr_test_name );\ - if ( fctkern_ptr__->ns.curr_test == NULL ) {\ - fctkern__log_warn(fctkern_ptr__, "out of memory");\ - } else if ( fctkern_ptr__->ns.ts_is_skip_suite \ - || fctkern_ptr__->ns.test_is_skip ) {\ - fct_ts__test_begin(fctkern_ptr__->ns.ts_curr);\ - fctkern__log_test_skip(\ - fctkern_ptr__,\ - fctkern_ptr__->ns.curr_test_name,\ - (fctkern_ptr__->ns.test_is_skip) ?\ - (fctkern_ptr__->ns.test_skip_cndtn) :\ - (fctkern_ptr__->ns.ts_skip_cndtn)\ - );\ - fct_ts__test_end(fctkern_ptr__->ns.ts_curr);\ - continue;\ - } else {\ - fctkern__log_test_start(fctkern_ptr__, fctkern_ptr__->ns.curr_test);\ - fct_test__start_timer(fctkern_ptr__->ns.curr_test);\ - for (;;) \ - { - - - - -#define FCT_TEST_END() \ - break;\ - }\ - fct_test__stop_timer(fctkern_ptr__->ns.curr_test);\ - }\ - fct_ts__add_test(fctkern_ptr__->ns.ts_curr, fctkern_ptr__->ns.curr_test);\ - fctkern__log_test_end(fctkern_ptr__, fctkern_ptr__->ns.curr_test);\ - }\ - fct_ts__test_end(fctkern_ptr__->ns.ts_curr);\ - continue;\ - }\ - }\ - - - -/* ---------------------------------------------------------- -CHECKING MACROS ----------------------------------------------------------- - -The chk variants will continue on while the req variants will abort -a test if a chk condition fails. The req variants are useful when you -no longer want to keep checking conditions because a critical condition -is not being met. */ - - -/* To support older compilers that do not have macro variable argument lists -we have to use a function. The macro manages to store away the line/file -location into a global before it runs this function, a trick I picked up from -the error handling in the APR library. The unfortunate thing is that we can -not carry forth the actual test through a "stringize" operation, but if you -wanted to do that you should use fct_chk. */ - -static int fct_xchk_lineno =0; -static char const *fct_xchk_file = NULL; -static fct_test_t *fct_xchk_test = NULL; -static fctkern_t *fct_xchk_kern =NULL; - - -static int -_fct_xchk_fn_varg( - char const *condition, - int is_pass, - char const *format, - va_list args -) -{ - fctchk_t *chk =NULL; - chk = fctchk_new( - is_pass, - condition, - fct_xchk_file, - fct_xchk_lineno, - format, - args - ); - if ( chk == NULL ) - { - fctkern__log_warn(fct_xchk_kern, "out of memory (aborting test)"); - goto finally; - } - - fct_test__add(fct_xchk_test, chk); - fctkern__log_chk(fct_xchk_kern, chk); -finally: - fct_xchk_lineno =0; - fct_xchk_file =NULL; - fct_xchk_test =NULL; - fct_xchk_kern =NULL; - return is_pass; -} - - -static int -fct_xchk2_fn(const char *condition, int is_pass, char const *format, ...) -{ - int r =0; - va_list args; - va_start(args, format); - r = _fct_xchk_fn_varg(condition, is_pass, format, args); - va_end(args); - return r; -} - - -static int -fct_xchk_fn(int is_pass, char const *format, ...) -{ - int r=0; - va_list args; - va_start(args, format); - r = _fct_xchk_fn_varg("", is_pass, format, args); - va_end(args); - return r; -} - - -/* Call this with the following argument list: - - fct_xchk(test_condition, format_str, ...) - -the bulk of this macro presets some globals to allow us to support -variable argument lists on older compilers. The idea came from the APR -libraries error checking routines. */ -#define fct_xchk fct_xchk_kern = fctkern_ptr__,\ - fct_xchk_test = fctkern_ptr__->ns.curr_test,\ - fct_xchk_lineno =__LINE__,\ - fct_xchk_file=__FILE__,\ - fct_xchk_fn - -#define fct_xchk2 fct_xchk_kern = fctkern_ptr__,\ - fct_xchk_test = fctkern_ptr__->ns.curr_test,\ - fct_xchk_lineno =__LINE__,\ - fct_xchk_file=__FILE__,\ - fct_xchk2_fn - - -/* This checks the condition and reports the condition as a string -if it fails. */ -#define fct_chk(_CNDTN_) (fct_xchk((_CNDTN_) ? 1 : 0, #_CNDTN_)) - -#define _fct_req(_CNDTN_) \ - if ( !(fct_xchk((_CNDTN_) ? 1 : 0, #_CNDTN_)) ) { break; } - - -/* When in test mode, construct a mock test object for fct_xchk to operate -with. If we fail a setup up, then we go directly to a teardown mode. */ -#define fct_req(_CNDTN_) \ - if ( fct_ts__is_test_mode(fctkern_ptr__->ns.ts_curr) ) { \ - _fct_req((_CNDTN_)); \ - } \ - else if ( fct_ts__is_setup_mode(fctkern_ptr__->ns.ts_curr) \ - || fct_ts__is_teardown_mode(fctkern_ptr__->ns.ts_curr) ) { \ - fctkern_ptr__->ns.curr_test = fct_ts__make_abort_test( \ - fctkern_ptr__->ns.ts_curr \ - ); \ - if ( !(fct_xchk((_CNDTN_) ? 1 : 0, #_CNDTN_)) ) { \ - fct_ts__setup_abort(fctkern_ptr__->ns.ts_curr); \ - fct_ts__add_test( \ - fctkern_ptr__->ns.ts_curr, fctkern_ptr__->ns.curr_test \ - ); \ - } \ - } else { \ - assert("invalid condition for fct_req!"); \ - _fct_req((_CNDTN_)); \ - } - - -#define fct_chk_eq_dbl(V1, V2) \ - fct_xchk(\ - ((int)(fabs((V1)-(V2)) < DBL_EPSILON)),\ - "chk_eq_dbl: %f != %f",\ - (V1),\ - (V2)\ - ) - - -#define fct_chk_neq_dbl(V1, V2) \ - fct_xchk(\ - ((int)(fabs((V1)-(V2)) >= DBL_EPSILON)),\ - "chk_neq_dbl: %f == %f",\ - (V1),\ - (V2)\ - ) - - -#define fct_chk_eq_str(V1, V2) \ - fct_xchk(fctstr_eq((V1), (V2)),\ - "chk_eq_str: '%s' != '%s'",\ - (V1),\ - (V2)\ - ) - - -#define fct_chk_neq_str(V1, V2) \ - fct_xchk(!fctstr_eq((V1), (V2)),\ - "chk_neq_str: '%s' == '%s'",\ - (V1),\ - (V2)\ - ) - -/* To quiet warnings with GCC, who think we are being silly and passing -in NULL to strlen, we will filter the predicate through these little -functions */ -static int -_fct_chk_empty_str(char const *s) -{ - if ( s == NULL ) - { - return 1; - } - return strlen(s) ==0; -} -static int -_fct_chk_full_str(char const *s) -{ - if ( s == NULL ) - { - return 0; - } - return strlen(s) >0; -} - - -#define fct_chk_empty_str(V) \ - fct_xchk(_fct_chk_empty_str((V)),\ - "string not empty: '%s'",\ - (V)\ - ) - -#define fct_chk_full_str(V) \ - fct_xchk(_fct_chk_full_str((V)),\ - "string is full: '%s'",\ - (V)\ - ) - - -#define fct_chk_eq_istr(V1, V2) \ - fct_xchk(fctstr_ieq((V1), (V2)),\ - "chk_eq_str: '%s' != '%s'",\ - (V1),\ - (V2)\ - ) - - -#define fct_chk_neq_istr(V1, V2) \ - fct_xchk(!fctstr_ieq((V1), (V2)),\ - "chk_neq_str: '%s' == '%s'",\ - (V1),\ - (V2)\ - ) - - -#define fct_chk_endswith_str(STR, CHECK)\ - fct_xchk(fctstr_endswith((STR),(CHECK)),\ - "fct_chk_endswith_str: '%s' doesn't end with '%s'",\ - (STR),\ - (CHECK)\ - ) - - -#define fct_chk_iendswith_str(STR, CHECK)\ - fct_xchk(fctstr_iendswith((STR), (CHECK)),\ - "fch_chk_iendswith_str: '%s' doesn't end with '%s'.",\ - (STR),\ - (CHECK)\ - ) - -#define fct_chk_excl_str(STR, CHECK_EXCLUDE) \ - fct_xchk(!fctstr_incl((STR), (CHECK_EXCLUDE)),\ - "fct_chk_excl_str: '%s' is included in '%s'",\ - (STR),\ - (CHECK_EXCLUDE)\ - ) - -#define fct_chk_excl_istr(ISTR, ICHECK_EXCLUDE) \ - fct_xchk(!fctstr_iincl((ISTR), (ICHECK_EXCLUDE)),\ - "fct_chk_excl_istr (case insensitive): '%s' is "\ - "included in'%s'",\ - (ISTR),\ - (ICHECK_EXCLUDE)\ - ) - -#define fct_chk_incl_str(STR, CHECK_INCLUDE) \ - fct_xchk(fctstr_incl((STR), (CHECK_INCLUDE)),\ - "fct_chk_incl_str: '%s' does not include '%s'",\ - (STR),\ - (CHECK_INCLUDE)\ - ) - - -#define fct_chk_incl_istr(ISTR, ICHECK_INCLUDE) \ - fct_xchk(fctstr_iincl((ISTR), (ICHECK_INCLUDE)),\ - "fct_chk_incl_istr (case insensitive): '%s' does "\ - "not include '%s'",\ - (ISTR),\ - (ICHECK_INCLUDE)\ - ) - - -#define fct_chk_startswith_str(STR, CHECK)\ - fct_xchk(fctstr_startswith((STR), (CHECK)),\ - "'%s' does not start with '%s'",\ - (STR),\ - (CHECK)\ - ) - - -#define fct_chk_startswith_istr(STR, CHECK)\ - fct_xchk(fctstr_istartswith((STR), (CHECK)),\ - "case insensitive check: '%s' does not start with '%s'",\ - (STR),\ - (CHECK)\ - ) - -#define fct_chk_eq_int(V1, V2) \ - fct_xchk(\ - ((V1) == (V2)),\ - "chq_eq_int: %d != %d",\ - (V1),\ - (V2)\ - ) - - -#define fct_chk_neq_int(V1, V2) \ - fct_xchk(\ - ((V1) != (V2)),\ - "chq_neq_int: %d == %d",\ - (V1),\ - (V2)\ - ) - -#define fct_chk_ex(EXCEPTION, CODE) \ - { \ - bool pass_chk_ex = false; \ - try { \ - CODE; \ - pass_chk_ex = false; \ - } catch ( EXCEPTION ) { \ - pass_chk_ex = true; \ - } catch ( ... ) { \ - pass_chk_ex = false; \ - } \ - fct_xchk( \ - pass_chk_ex, \ - "%s exception not generated", \ - #EXCEPTION \ - ); \ - } \ - -/* ---------------------------------------------------------- -GUT CHECK MACROS ----------------------------------------------------------- - -The following macros are used to help check the "guts" of -the FCT, and to confirm that it all works according to spec. -*/ - -/* Generates a message to STDERR and exits the application with a -non-zero number. */ -#define _FCT_GUTCHK(_CNDTN_) \ - if ( !(_CNDTN_) ) {\ - fprintf(stderr, "gutchk fail: '" #_CNDTN_ "' was not true.\n");\ - exit(1);\ - }\ - else {\ - fprintf(stdout, "gutchk pass: '" #_CNDTN_ "'\n");\ - } - -/* ---------------------------------------------------------- -MULTI-FILE TEST SUITE MACROS ----------------------------------------------------------- - -I struggled trying to figure this out in a way that was -as simple as possible. I wanted to be able to define -the test suite in one object file, then refer it within -the other one within the minimum amount of typing. - -Unfortunately without resorting to some supermacro -work, I could only find a happy comprimise. - -See test_multi.c for an example. -*/ - -/* The following macros are used in your separate object -file to define your test suite. */ - - -#define FCTMF_FIXTURE_SUITE_BGN(NAME) \ - void NAME (fctkern_t *fctkern_ptr__) {\ - FCT_REFERENCE_FUNCS();\ - FCT_FIXTURE_SUITE_BGN( NAME ) { - -#define FCTMF_FIXTURE_SUITE_END() \ - } FCT_FIXTURE_SUITE_END();\ - } - -#define FCTMF_SUITE_BGN(NAME) \ - void NAME (fctkern_t *fctkern_ptr__) {\ - FCT_REFERENCE_FUNCS();\ - FCT_SUITE_BGN( NAME ) { -#define FCTMF_SUITE_END() \ - } FCT_SUITE_END(); \ - } - - -/* Deprecated, no longer required. */ -#define FCTMF_SUITE_DEF(NAME) - - -/* Executes a test suite defined by FCTMF_SUITE* */ -#define FCTMF_SUITE_CALL(NAME) {\ - void NAME (fctkern_t *);\ - NAME (fctkern_ptr__);\ - } - - -/* ---------------------------------------------------------- -FCT QUICK TEST API ----------------------------------------------------------- -The goal of these little macros is to try and get you -up and running with a test as quick as possible. - -The basic idea is that there is one test per test suite. -*/ - -#define FCT_QTEST_BGN(NAME) \ - FCT_SUITE_BGN(NAME) {\ - FCT_TEST_BGN(NAME) {\ - -#define FCT_QTEST_END() \ - } FCT_TEST_END();\ - } FCT_SUITE_END(); - - -#define FCT_QTEST_BGN_IF(_CONDITION_, _NAME_) \ - FCT_SUITE_BGN(_NAME_) {\ - FCT_TEST_BGN_IF(_CONDITION_, _NAME_) {\ - -#define FCT_QTEST_END_IF() \ - } FCT_TEST_END_IF();\ - } FCT_SUITE_END(); - -#endif /* !FCT_INCLUDED__IMB */ diff --git a/tests/scripts/generate_code.pl b/tests/scripts/generate_code.pl index 4565c617a..40f993ff8 100755 --- a/tests/scripts/generate_code.pl +++ b/tests/scripts/generate_code.pl @@ -9,9 +9,8 @@ my $data_name = shift or die "Missing data name"; my $test_file = $data_name.".c"; my $test_helper_file = $suite_dir."/helpers.function"; my $test_case_file = $suite_dir."/".$suite_name.".function"; -my $test_data_file = $suite_dir."/".$data_name.".data"; - -open(TEST_DATA, "$test_data_file") or die "Opening test cases '$test_data_file': $!"; +my $test_case_data = $suite_dir."/".$data_name.".data"; +my $test_main_file = $suite_dir."/main_test.function"; my $line_separator = $/; undef $/; @@ -20,21 +19,33 @@ open(TEST_HELPERS, "$test_helper_file") or die "Opening test helpers '$test_help my $test_helpers = ; close(TEST_HELPERS); +open(TEST_MAIN, "$test_main_file") or die "Opening test main '$test_main_file': $!"; +my $test_main = ; +close(TEST_MAIN); + open(TEST_CASES, "$test_case_file") or die "Opening test cases '$test_case_file': $!"; my $test_cases = ; close(TEST_CASES); -my ( $suite_header ) = $test_cases =~ /BEGIN_HEADER\n(.*?)\nEND_HEADER/s; -my ( $suite_defines ) = $test_cases =~ /BEGIN_DEPENDENCIES\n(.*?)\nEND_DEPENDENCIES/s; + +open(TEST_DATA, "$test_case_data") or die "Opening test data '$test_case_data': $!"; +my $test_data = ; +close(TEST_DATA); + +my ( $suite_header ) = $test_cases =~ /\/\* BEGIN_HEADER \*\/\n(.*?)\n\/\* END_HEADER \*\//s; +my ( $suite_defines ) = $test_cases =~ /\/\* BEGIN_DEPENDENCIES\n \* (.*?)\n \* END_DEPENDENCIES/s; my $requirements; if ($suite_defines =~ /^depends_on:/) { ( $requirements ) = $suite_defines =~ /^depends_on:(.*)$/; } - + my @var_req_arr = split(/:/, $requirements); my $suite_pre_code; my $suite_post_code; +my $dispatch_code; +my $mapping_code; +my %mapping_values; while (@var_req_arr) { @@ -48,114 +59,168 @@ $/ = $line_separator; open(TEST_FILE, ">$test_file") or die "Opening destination file '$test_file': $!"; print TEST_FILE << "END"; -#include "fct.h" #include $suite_header $test_helpers -FCT_BGN() -{ -$suite_pre_code - -#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) - unsigned char buf[1000000]; - memory_buffer_alloc_init( buf, sizeof(buf) ); -#endif - - - FCT_SUITE_BGN($suite_name) - { END -while (my $line = ) +$test_main =~ s/SUITE_PRE_DEP/$suite_pre_code/; +$test_main =~ s/SUITE_POST_DEP/$suite_post_code/; + +while($test_cases =~ /\/\* BEGIN_CASE *([\w:]*) \*\/\n(.*?)\n\/\* END_CASE \*\//msg) { - my $description = $line; - $line = ; + my $function_deps = $1; + my $function_decl = $2; - my $test_name = $description; - $test_name =~ tr/A-Z \-/a-z__/; - $test_name =~ tr/a-z0-9_//cd; - - # Carve the defines required for this test case - my $requirements; - if ($line =~ /^depends_on:/) + # Sanity checks of function + if ($function_decl !~ /^void /) { - my $depends_on_line = $line; - $line = ; - - ( $requirements ) = $depends_on_line =~ /^depends_on:(.*)$/; + die "Test function does not have 'void' as return type\n"; } - - my @var_req_arr = split(/:/, $requirements); - my $pre_code; - my $post_code; - - while (@var_req_arr) + if ($function_decl !~ /^void (\w+)\(\s*(.*?)\s*\)\s*{(.*?)}/ms) { - my $req = shift @var_req_arr; + die "Function declaration not in expected format\n"; + } + my $function_name = $1; + my $function_params = $2; + my $function_pre_code; + my $function_post_code; + my $param_defs; + my $param_checks; + my @dispatch_params; + my @var_def_arr = split(/,\s*/, $function_params); + my $i = 1; + my $mapping_regex = "".$function_name; + my $mapping_count = 0; - $pre_code .= "#ifdef $req\n"; - $post_code .= "#endif /* $req */\n"; + $function_decl =~ s/^void /void test_suite_/; + + if ($function_deps =~ /^depends_on:/) + { + ( $function_deps ) = $function_deps =~ /^depends_on:(.*)$/; } - my $command_line = $line; - $line = ; - - # Carve the case name and variable values - # - my ( $case, $var_value ) = $command_line =~ /^([\w_]+):(.*)$/; - - # Escape the escaped colons (Not really escaped now) - # - $var_value =~ s/\\:/{colon_sign}/g; - - # Carve the case and variable definition - # - my ( $var_def, $case_code ) = $test_cases =~ /BEGIN_CASE\n$case:([^\n]*)\n(.*?)\nEND_CASE/s; - - my @var_def_arr = split(/:/, $var_def); - my @var_value_arr = split(/:/, $var_value); - - while (@var_def_arr) + foreach my $req (split(/:/, $function_deps)) { - my $def = shift @var_def_arr; - my $val = shift @var_value_arr; - - $case_code =~ s/\{$def\}/$val/g; + $function_pre_code .= "#ifdef $req\n"; + $function_post_code .= "#endif /* $req */\n"; } - $case_code = "int ${test_name}_code_present = 0;\nTEST_ASSERT( ${test_name}_code_present == 1 );" if ($case_code =~ /^\s*$/); - $case_code =~ s/{colon_sign}/:/g; - $case_code =~ s/TEST_ASSERT/fct_chk/g; - $case_code =~ s/TEST_EQUALS/fct_chk/g; + foreach my $def (@var_def_arr) + { + # Handle the different parameter types + if( substr($def, 0, 4) eq "int " ) + { + $param_defs .= " int param$i;\n"; + $param_checks .= " if( verify_int( params[$i], ¶m$i ) != 0 ) return( 2 );\n"; + push @dispatch_params, "param$i"; - $case_code =~ s/^/ /gm; + $mapping_regex .= ":([\\d\\w |\\+\\-\\(\\)]+)"; + $mapping_count++; + } + elsif( substr($def, 0, 6) eq "char *" ) + { + $param_defs .= " char *param$i = params[$i];\n"; + $param_checks .= " if( verify_string( ¶m$i ) != 0 ) return( 2 );\n"; + push @dispatch_params, "param$i"; + $mapping_regex .= ":[^:]+"; + } + else + { + die "Parameter declaration not of supported type (int, char *)\n"; + } + $i++; + } - print TEST_FILE << "END"; -$pre_code - FCT_TEST_BGN($test_name) -$case_code - FCT_TEST_END(); -$post_code + # Find non-integer values we should map for this function + if( $mapping_count) + { + my @res = $test_data =~ /^$mapping_regex/msg; + foreach my $value (@res) + { + $mapping_values{$value} = 1 if ($value !~ /^\d+$/); + } + } + + my $call_params = join ", ", @dispatch_params; + my $param_count = @var_def_arr + 1; + $dispatch_code .= << "END"; +if( strcmp( params[0], "$function_name" ) == 0 ) +{ +$function_pre_code +$param_defs + if( cnt != $param_count ) + { + fprintf( stderr, "\\nIncorrect argument count (%d != %d)\\n", cnt, $param_count ); + return( 2 ); + } + +$param_checks + test_suite_$function_name( $call_params ); + return ( 0 ); +$function_post_code + return ( 3 ); +} +else +END + + my $function_code = $function_pre_code . $function_decl . "\n" . $function_post_code; + $test_main =~ s/FUNCTION_CODE/$function_code\nFUNCTION_CODE/; +} + +# Find specific case dependencies that we should be able to check +# and make check code +my $dep_check_code; + +my @res = $test_data =~ /^depends_on:([\w:]+)/msg; +my %case_deps; +foreach my $deps (@res) +{ + foreach my $dep (split(/:/, $deps)) + { + $case_deps{$dep} = 1; + } +} +while( my ($key, $value) = each(%case_deps) ) +{ + $dep_check_code .= << "END"; + if( strcmp( str, "$key" ) == 0 ) + { +#if defined($key) + return( 0 ); +#else + return( 1 ); +#endif + } END } +# Make mapping code +while( my ($key, $value) = each(%mapping_values) ) +{ + $mapping_code .= << "END"; + if( strcmp( str, "$key" ) == 0 ) + { + *value = ( $key ); + return( 0 ); + } +END +} + +$dispatch_code =~ s/^(.+)/ $1/mg; + +$test_main =~ s/TEST_FILENAME/$test_case_data/; +$test_main =~ s/FUNCTION_CODE//; +$test_main =~ s/DEP_CHECK_CODE/$dep_check_code/; +$test_main =~ s/DISPATCH_FUNCTION/$dispatch_code/; +$test_main =~ s/MAPPING_CODE/$mapping_code/; + print TEST_FILE << "END"; - } - FCT_SUITE_END(); - -#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && defined(POLARSSL_MEMORY_DEBUG) - memory_buffer_alloc_status(); -#endif - -$suite_post_code -} -FCT_END(); - +$test_main END -close(TEST_DATA); close(TEST_FILE); diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 66af8af27..881a0ac6f 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -9,6 +9,10 @@ typedef UINT32 uint32_t; #include #endif +#include +#include +#include + /* * 32-bit integer manipulation macros (big endian) */ diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function new file mode 100644 index 000000000..4a343190b --- /dev/null +++ b/tests/suites/main_test.function @@ -0,0 +1,296 @@ +#include +#include + +static int test_errors = 0; + +static int test_assert( int correct, char *test ) +{ + if( correct ) + return( 0 ); + + test_errors++; + if( test_errors == 1 ) + printf( "FAILED\n" ); + printf( " %s\n", test ); + + return( 1 ); +} + +#define TEST_ASSERT( TEST ) \ + do { test_assert( (TEST) ? 1 : 0, #TEST ); \ + if( test_errors) return; \ + } while (0) + +int verify_string( char **str ) +{ + if( (*str)[0] != '"' || + (*str)[strlen( *str ) - 1] != '"' ) + { + printf( "Expected string (with \"\") for parameter and got: %s\n", *str ); + return( -1 ); + } + + (*str)++; + (*str)[strlen( *str ) - 1] = '\0'; + + return( 0 ); +} + +int verify_int( char *str, int *value ) +{ + size_t i; + int minus = 0; + int digits = 1; + int hex = 0; + + for( i = 0; i < strlen( str ); i++ ) + { + if( i == 0 && str[i] == '-' ) + { + minus = 1; + continue; + } + + if( ( ( minus && i == 2 ) || ( !minus && i == 1 ) ) && + str[i - 1] == '0' && str[i] == 'x' ) + { + hex = 1; + continue; + } + + if( str[i] < '0' || str[i] > '9' ) + { + digits = 0; + break; + } + } + + if( digits ) + { + if( hex ) + *value = strtol( str, NULL, 16 ); + else + *value = strtol( str, NULL, 10 ); + + return( 0 ); + } + +MAPPING_CODE + + printf( "Expected integer for parameter and got: %s\n", str ); + return( -1 ); +} + +int dep_check( char *str ) +{ + if( str == NULL ) + return( 1 ); + +DEP_CHECK_CODE + + return( 1 ); +} + +SUITE_PRE_DEP +#define TEST_SUITE_ACTIVE +FUNCTION_CODE +SUITE_POST_DEP + +int dispatch_test(int cnt, char *params[50]) +{ + int ret; + ((void) cnt); + ((void) params); + +#if defined(TEST_SUITE_ACTIVE) +DISPATCH_FUNCTION + { + fprintf( stdout, "FAILED\nSkipping unknown test function '%s'\n", params[0] ); + fflush( stdout ); + return( 1 ); + } +#else + return( 3 ); +#endif + return( ret ); +} + +int get_line( FILE *f, char *buf, size_t len ) +{ + char *ret; + + ret = fgets( buf, len, f ); + if( ret == NULL ) + return( -1 ); + + if( strlen( buf ) && buf[strlen(buf) - 1] == '\n' ) + buf[strlen(buf) - 1] = '\0'; + if( strlen( buf ) && buf[strlen(buf) - 1] == '\r' ) + buf[strlen(buf) - 1] = '\0'; + + return( 0 ); +} + +int parse_arguments( char *buf, size_t len, char *params[50] ) +{ + int cnt = 0, i; + char *cur = buf; + char *p = buf, *q; + + params[cnt++] = cur; + + while( *p != '\0' && p < buf + len ) + { + if( *p == '\\' ) + { + *p++; + *p++; + continue; + } + if( *p == ':' ) + { + if( p + 1 < buf + len ) + { + cur = p + 1; + params[cnt++] = cur; + } + *p = '\0'; + } + + *p++; + } + + // Replace newlines, question marks and colons in strings + for( i = 0; i < cnt; i++ ) + { + p = params[i]; + q = params[i]; + + while( *p != '\0' ) + { + if( *p == '\\' && *(p + 1) == 'n' ) + { + p += 2; + *(q++) = '\n'; + } + else if( *p == '\\' && *(p + 1) == ':' ) + { + p += 2; + *(q++) = ':'; + } + else if( *p == '\\' && *(p + 1) == '?' ) + { + p += 2; + *(q++) = '?'; + } + else + *(q++) = *(p++); + } + *q = '\0'; + } + + return( cnt ); +} + +int main() +{ + int ret, i, cnt, total_errors = 0, total_tests = 0, total_skipped = 0; + const char *filename = "TEST_FILENAME"; + FILE *file; + char buf[5000]; + char *params[50]; + +#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) + unsigned char buf[1000000]; + memory_buffer_alloc_init( buf, sizeof(buf) ); +#endif + + file = fopen( filename, "r" ); + if( file == NULL ) + { + fprintf( stderr, "Failed to open\n" ); + return( 1 ); + } + + while( !feof( file ) ) + { + int skip = 0; + + if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 ) + break; + fprintf( stdout, "%s%.66s", test_errors ? "\n" : "", buf ); + fprintf( stdout, " " ); + for( i = strlen( buf ) + 1; i < 67; i++ ) + fprintf( stdout, "." ); + fprintf( stdout, " " ); + fflush( stdout ); + + total_tests++; + + if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 ) + break; + cnt = parse_arguments( buf, strlen(buf), params ); + + if( strcmp( params[0], "depends_on" ) == 0 ) + { + for( i = 1; i < cnt; i++ ) + if( dep_check( params[i] ) != 0 ) + skip = 1; + + if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 ) + break; + cnt = parse_arguments( buf, strlen(buf), params ); + } + + if( skip == 0 ) + { + test_errors = 0; + ret = dispatch_test( cnt, params ); + } + + if( skip == 1 || ret == 3 ) + { + total_skipped++; + fprintf( stdout, "----\n" ); + fflush( stdout ); + } + else if( ret == 0 && test_errors == 0 ) + { + fprintf( stdout, "PASS\n" ); + fflush( stdout ); + } + else if( ret == 2 ) + { + fprintf( stderr, "FAILED: FATAL PARSE ERROR\n" ); + fclose(file); + exit( 2 ); + } + else + total_errors++; + + if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 ) + break; + if( strlen(buf) != 0 ) + { + fprintf( stderr, "Should be empty %d\n", (int) strlen(buf) ); + return( 1 ); + } + } + fclose(file); + + fprintf( stdout, "\n----------------------------------------------------------------------------\n\n"); + if( total_errors == 0 ) + fprintf( stdout, "PASSED" ); + else + fprintf( stdout, "FAILED" ); + + fprintf( stdout, " (%d / %d tests (%d skipped))\n", + total_tests - total_errors, total_tests, total_skipped ); + +#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && defined(POLARSSL_MEMORY_DEBUG) + memory_buffer_alloc_status(); +#endif + + return( total_errors != 0 ); +} + diff --git a/tests/suites/test_suite_aes.function b/tests/suites/test_suite_aes.function index 6c3085341..747abf145 100644 --- a/tests/suites/test_suite_aes.function +++ b/tests/suites/test_suite_aes.function @@ -1,13 +1,15 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_AES_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_AES_C + * END_DEPENDENCIES + */ -BEGIN_CASE -aes_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result +/* BEGIN_CASE */ +void aes_encrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string, int setkey_result ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -21,22 +23,23 @@ aes_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); - TEST_ASSERT( aes_setkey_enc( &ctx, key_str, key_len * 8 ) == {setkey_result} ); - if( {setkey_result} == 0 ) + TEST_ASSERT( aes_setkey_enc( &ctx, key_str, key_len * 8 ) == setkey_result ); + if( setkey_result == 0 ) { TEST_ASSERT( aes_crypt_ecb( &ctx, AES_ENCRYPT, src_str, output ) == 0 ); hexify( dst_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -aes_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result +/* BEGIN_CASE */ +void aes_decrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string, int setkey_result ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -50,22 +53,24 @@ aes_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); - TEST_ASSERT( aes_setkey_dec( &ctx, key_str, key_len * 8 ) == {setkey_result} ); - if( {setkey_result} == 0 ) + TEST_ASSERT( aes_setkey_dec( &ctx, key_str, key_len * 8 ) == setkey_result ); + if( setkey_result == 0 ) { TEST_ASSERT( aes_crypt_ecb( &ctx, AES_DECRYPT, src_str, output ) == 0 ); hexify( dst_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -aes_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void aes_encrypt_cbc( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string, + int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -81,23 +86,25 @@ aes_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_r memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - data_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + data_len = unhexify( src_str, hex_src_string ); aes_setkey_enc( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( aes_crypt_cbc( &ctx, AES_ENCRYPT, data_len, iv_str, src_str, output ) == {cbc_result} ); - if( {cbc_result} == 0 ) + TEST_ASSERT( aes_crypt_cbc( &ctx, AES_ENCRYPT, data_len, iv_str, src_str, output ) == cbc_result ); + if( cbc_result == 0 ) { hexify( dst_str, output, data_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -aes_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void aes_decrypt_cbc( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string, + int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -113,23 +120,24 @@ aes_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_r memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - data_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + data_len = unhexify( src_str, hex_src_string ); aes_setkey_dec( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( aes_crypt_cbc( &ctx, AES_DECRYPT, data_len, iv_str, src_str, output ) == {cbc_result} ); - if( {cbc_result} == 0) + TEST_ASSERT( aes_crypt_cbc( &ctx, AES_DECRYPT, data_len, iv_str, src_str, output ) == cbc_result ); + if( cbc_result == 0) { hexify( dst_str, output, data_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -aes_encrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void aes_encrypt_cfb128( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -146,20 +154,21 @@ aes_encrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + unhexify( src_str, hex_src_string ); aes_setkey_enc( &ctx, key_str, key_len * 8 ); TEST_ASSERT( aes_crypt_cfb128( &ctx, AES_ENCRYPT, 16, &iv_offset, iv_str, src_str, output ) == 0 ); hexify( dst_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -aes_decrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void aes_decrypt_cfb128( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -176,21 +185,21 @@ aes_decrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + unhexify( src_str, hex_src_string ); aes_setkey_enc( &ctx, key_str, key_len * 8 ); TEST_ASSERT( aes_crypt_cfb128( &ctx, AES_DECRYPT, 16, &iv_offset, iv_str, src_str, output ) == 0 ); hexify( dst_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -aes_selftest: +/* BEGIN_CASE */ +void aes_selftest() { TEST_ASSERT( aes_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_arc4.function b/tests/suites/test_suite_arc4.function index edfe5c748..302b2e5f9 100644 --- a/tests/suites/test_suite_arc4.function +++ b/tests/suites/test_suite_arc4.function @@ -1,13 +1,15 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_ARC4_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_ARC4_C + * END_DEPENDENCIES + */ -BEGIN_CASE -arc4_crypt:hex_src_string:hex_key_string:hex_dst_string +/* BEGIN_CASE */ +void arc4_crypt( char *hex_src_string, char *hex_key_string, + char *hex_dst_string ) { unsigned char src_str[1000]; unsigned char key_str[1000]; @@ -21,20 +23,20 @@ arc4_crypt:hex_src_string:hex_key_string:hex_dst_string memset(dst_str, 0x00, 1000); memset(dst_hexstr, 0x00, 2000); - src_len = unhexify( src_str, {hex_src_string} ); - key_len = unhexify( key_str, {hex_key_string} ); + src_len = unhexify( src_str, hex_src_string ); + key_len = unhexify( key_str, hex_key_string ); arc4_setup(&ctx, key_str, key_len); TEST_ASSERT( arc4_crypt(&ctx, src_len, src_str, dst_str ) == 0 ); hexify( dst_hexstr, dst_str, src_len ); - TEST_ASSERT( strcmp( (char *) dst_hexstr, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_hexstr, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -arc4_selftest: +/* BEGIN_CASE */ +void arc4_selftest() { TEST_ASSERT( arc4_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_base64.function b/tests/suites/test_suite_base64.function index 50c7dcc36..1355a9669 100644 --- a/tests/suites/test_suite_base64.function +++ b/tests/suites/test_suite_base64.function @@ -1,32 +1,34 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_BASE64_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_BASE64_C + * END_DEPENDENCIES + */ -BEGIN_CASE -base64_encode:src_string:dst_string:dst_buf_size:result +/* BEGIN_CASE */ +void base64_encode( char *src_string, char *dst_string, int dst_buf_size, + int result ) { unsigned char src_str[1000]; unsigned char dst_str[1000]; - size_t len = {dst_buf_size}; + size_t len = dst_buf_size; memset(src_str, 0x00, 1000); memset(dst_str, 0x00, 1000); - strcpy( (char *) src_str, {src_string} ); - TEST_ASSERT( base64_encode( dst_str, &len, src_str, strlen( (char *) src_str ) ) == {result} ); - if( {result} == 0 ) + strcpy( (char *) src_str, src_string ); + TEST_ASSERT( base64_encode( dst_str, &len, src_str, strlen( (char *) src_str ) ) == result ); + if( result == 0 ) { - TEST_ASSERT( strcmp( (char *) dst_str, {dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -base64_decode:src_string:dst_string:result +/* BEGIN_CASE */ +void base64_decode( char *src_string, char *dst_string, int result ) { unsigned char src_str[1000]; unsigned char dst_str[1000]; @@ -36,18 +38,18 @@ base64_decode:src_string:dst_string:result memset(src_str, 0x00, 1000); memset(dst_str, 0x00, 1000); - strcpy( (char *) src_str, {src_string} ); - TEST_ASSERT( res = base64_decode( dst_str, &len, src_str, strlen( (char *) src_str ) ) == {result} ); - if( {result} == 0 ) + strcpy( (char *) src_str, src_string ); + TEST_ASSERT( res = base64_decode( dst_str, &len, src_str, strlen( (char *) src_str ) ) == result ); + if( result == 0 ) { - TEST_ASSERT( strcmp( (char *) dst_str, {dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -base64_selftest: +/* BEGIN_CASE */ +void base64_selftest() { TEST_ASSERT( base64_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_blowfish.data b/tests/suites/test_suite_blowfish.data index b86093796..8c5f70e10 100644 --- a/tests/suites/test_suite_blowfish.data +++ b/tests/suites/test_suite_blowfish.data @@ -296,13 +296,13 @@ BLOWFISH-CBC Decrypt blowfish_decrypt_cbc:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"6B77B4D63006DEE605B156E27403979358DEB9E7154616D959F1652BD5FF92CC00":"":POLARSSL_ERR_BLOWFISH_INVALID_INPUT_LENGTH BLOWFISH-CFB Encrypt -blowfish_encrypt_cfb64:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"37363534333231204E6F77206973207468652074696D6520666F722000":"e73214a2822139caf26ecf6d2eb9e76e3da3de04d1517200519d57a6c3":0 +blowfish_encrypt_cfb64:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"37363534333231204E6F77206973207468652074696D6520666F722000":"e73214a2822139caf26ecf6d2eb9e76e3da3de04d1517200519d57a6c3" BLOWFISH-CFB Decrypt -blowfish_decrypt_cfb64:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"E73214A2822139CAF26ECF6D2EB9E76E3DA3DE04D1517200519D57A6C3":"37363534333231204e6f77206973207468652074696d6520666f722000":0 +blowfish_decrypt_cfb64:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"E73214A2822139CAF26ECF6D2EB9E76E3DA3DE04D1517200519D57A6C3":"37363534333231204e6f77206973207468652074696d6520666f722000" BLOWFISH-CTR Encrypt -blowfish_encrypt_ctr:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"37363534333231204E6F77206973207468652074696D6520666F722000":"e73214a2822139ca60254740dd8c5b8acf5e9569c4affeb944b8fc020e":0 +blowfish_encrypt_ctr:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"37363534333231204E6F77206973207468652074696D6520666F722000":"e73214a2822139ca60254740dd8c5b8acf5e9569c4affeb944b8fc020e" BLOWFISH-CTR Decrypt -blowfish_encrypt_ctr:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"e73214a2822139ca60254740dd8c5b8acf5e9569c4affeb944b8fc020e":"37363534333231204e6f77206973207468652074696d6520666f722000":0 +blowfish_encrypt_ctr:"0123456789ABCDEFF0E1D2C3B4A59687":"FEDCBA9876543210":"e73214a2822139ca60254740dd8c5b8acf5e9569c4affeb944b8fc020e":"37363534333231204e6f77206973207468652074696d6520666f722000" diff --git a/tests/suites/test_suite_blowfish.function b/tests/suites/test_suite_blowfish.function index 8a1e3447f..6bdcb6546 100644 --- a/tests/suites/test_suite_blowfish.function +++ b/tests/suites/test_suite_blowfish.function @@ -1,13 +1,15 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include "polarssl/blowfish.h" -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_BLOWFISH_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_BLOWFISH_C + * END_DEPENDENCIES + */ -BEGIN_CASE -blowfish_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result +/* BEGIN_CASE */ +void blowfish_encrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string, int setkey_result ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -21,22 +23,23 @@ blowfish_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); - TEST_ASSERT( blowfish_setkey( &ctx, key_str, key_len * 8 ) == {setkey_result} ); - if( {setkey_result} == 0 ) + TEST_ASSERT( blowfish_setkey( &ctx, key_str, key_len * 8 ) == setkey_result ); + if( setkey_result == 0 ) { TEST_ASSERT( blowfish_crypt_ecb( &ctx, BLOWFISH_ENCRYPT, src_str, output ) == 0 ); hexify( dst_str, output, 8 ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -blowfish_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result +/* BEGIN_CASE */ +void blowfish_decrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string, int setkey_result ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -50,22 +53,24 @@ blowfish_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); - TEST_ASSERT( blowfish_setkey( &ctx, key_str, key_len * 8 ) == {setkey_result} ); - if( {setkey_result} == 0 ) + TEST_ASSERT( blowfish_setkey( &ctx, key_str, key_len * 8 ) == setkey_result ); + if( setkey_result == 0 ) { TEST_ASSERT( blowfish_crypt_ecb( &ctx, BLOWFISH_DECRYPT, src_str, output ) == 0 ); hexify( dst_str, output, 8 ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -blowfish_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void blowfish_encrypt_cbc( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string, + int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -81,24 +86,26 @@ blowfish_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string: memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - data_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + data_len = unhexify( src_str, hex_src_string ); blowfish_setkey( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( blowfish_crypt_cbc( &ctx, BLOWFISH_ENCRYPT, data_len , iv_str, src_str, output ) == {cbc_result} ); - if( {cbc_result} == 0 ) + TEST_ASSERT( blowfish_crypt_cbc( &ctx, BLOWFISH_ENCRYPT, data_len , iv_str, src_str, output ) == cbc_result ); + if( cbc_result == 0 ) { hexify( dst_str, output, data_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -blowfish_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void blowfish_decrypt_cbc( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string, + int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -114,23 +121,24 @@ blowfish_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string: memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - data_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + data_len = unhexify( src_str, hex_src_string ); blowfish_setkey( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( blowfish_crypt_cbc( &ctx, BLOWFISH_DECRYPT, data_len , iv_str, src_str, output ) == {cbc_result} ); - if( {cbc_result} == 0) + TEST_ASSERT( blowfish_crypt_cbc( &ctx, BLOWFISH_DECRYPT, data_len , iv_str, src_str, output ) == cbc_result ); + if( cbc_result == 0) { hexify( dst_str, output, data_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -blowfish_encrypt_cfb64:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void blowfish_encrypt_cfb64( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -147,20 +155,21 @@ blowfish_encrypt_cfb64:hex_key_string:hex_iv_string:hex_src_string:hex_dst_strin memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + src_len = unhexify( src_str, hex_src_string ); blowfish_setkey( &ctx, key_str, key_len * 8 ); TEST_ASSERT( blowfish_crypt_cfb64( &ctx, BLOWFISH_ENCRYPT, src_len, &iv_offset, iv_str, src_str, output ) == 0 ); hexify( dst_str, output, src_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -blowfish_decrypt_cfb64:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void blowfish_decrypt_cfb64( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -177,20 +186,21 @@ blowfish_decrypt_cfb64:hex_key_string:hex_iv_string:hex_src_string:hex_dst_strin memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + src_len = unhexify( src_str, hex_src_string ); blowfish_setkey( &ctx, key_str, key_len * 8 ); TEST_ASSERT( blowfish_crypt_cfb64( &ctx, BLOWFISH_DECRYPT, src_len, &iv_offset, iv_str, src_str, output ) == 0 ); hexify( dst_str, output, src_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -blowfish_encrypt_ctr:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void blowfish_encrypt_ctr( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -209,14 +219,14 @@ blowfish_encrypt_ctr:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + src_len = unhexify( src_str, hex_src_string ); blowfish_setkey( &ctx, key_str, key_len * 8 ); TEST_ASSERT( blowfish_crypt_ctr( &ctx, src_len, &iv_offset, iv_str, stream_str, src_str, output ) == 0 ); hexify( dst_str, output, src_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_camellia.function b/tests/suites/test_suite_camellia.function index 15bedceb7..a219e7ad0 100644 --- a/tests/suites/test_suite_camellia.function +++ b/tests/suites/test_suite_camellia.function @@ -1,13 +1,15 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_CAMELLIA_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_CAMELLIA_C + * END_DEPENDENCIES + */ -BEGIN_CASE -camellia_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result +/* BEGIN_CASE */ +void camellia_encrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string, int setkey_result ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -21,22 +23,23 @@ camellia_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); - TEST_ASSERT( camellia_setkey_enc( &ctx, key_str, key_len * 8 ) == {setkey_result} ); - if( {setkey_result} == 0 ) + TEST_ASSERT( camellia_setkey_enc( &ctx, key_str, key_len * 8 ) == setkey_result ); + if( setkey_result == 0 ) { TEST_ASSERT( camellia_crypt_ecb( &ctx, CAMELLIA_ENCRYPT, src_str, output ) == 0 ); hexify( dst_str, output, 16 ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -camellia_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result +/* BEGIN_CASE */ +void camellia_decrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string, int setkey_result ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -50,22 +53,24 @@ camellia_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); - TEST_ASSERT( camellia_setkey_dec( &ctx, key_str, key_len * 8 ) == {setkey_result} ); - if( {setkey_result} == 0 ) + TEST_ASSERT( camellia_setkey_dec( &ctx, key_str, key_len * 8 ) == setkey_result ); + if( setkey_result == 0 ) { TEST_ASSERT( camellia_crypt_ecb( &ctx, CAMELLIA_DECRYPT, src_str, output ) == 0 ); hexify( dst_str, output, 16 ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -camellia_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void camellia_encrypt_cbc( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string, + int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -81,23 +86,25 @@ camellia_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string: memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - data_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + data_len = unhexify( src_str, hex_src_string ); camellia_setkey_enc( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( camellia_crypt_cbc( &ctx, CAMELLIA_ENCRYPT, data_len, iv_str, src_str, output) == {cbc_result} ); - if( {cbc_result} == 0 ) + TEST_ASSERT( camellia_crypt_cbc( &ctx, CAMELLIA_ENCRYPT, data_len, iv_str, src_str, output) == cbc_result ); + if( cbc_result == 0 ) { hexify( dst_str, output, data_len ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -camellia_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void camellia_decrypt_cbc( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string, + int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -113,23 +120,24 @@ camellia_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string: memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - data_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + data_len = unhexify( src_str, hex_src_string ); camellia_setkey_dec( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( camellia_crypt_cbc( &ctx, CAMELLIA_DECRYPT, data_len, iv_str, src_str, output ) == {cbc_result} ); - if( {cbc_result} == 0 ) + TEST_ASSERT( camellia_crypt_cbc( &ctx, CAMELLIA_DECRYPT, data_len, iv_str, src_str, output ) == cbc_result ); + if( cbc_result == 0 ) { hexify( dst_str, output, data_len ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -camellia_encrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void camellia_encrypt_cfb128( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -146,20 +154,21 @@ camellia_encrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_stri memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + unhexify( src_str, hex_src_string ); camellia_setkey_enc( &ctx, key_str, key_len * 8 ); TEST_ASSERT( camellia_crypt_cfb128( &ctx, CAMELLIA_ENCRYPT, 16, &iv_offset, iv_str, src_str, output ) == 0 ); hexify( dst_str, output, 16 ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -camellia_decrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void camellia_decrypt_cfb128( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -176,21 +185,21 @@ camellia_decrypt_cfb128:hex_key_string:hex_iv_string:hex_src_string:hex_dst_stri memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - key_len = unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + unhexify( src_str, hex_src_string ); camellia_setkey_enc( &ctx, key_str, key_len * 8 ); TEST_ASSERT( camellia_crypt_cfb128( &ctx, CAMELLIA_DECRYPT, 16, &iv_offset, iv_str, src_str, output ) == 0 ); hexify( dst_str, output, 16 ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -camellia_selftest: +/* BEGIN_CASE */ +void camellia_selftest() { TEST_ASSERT( camellia_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_cipher.aes.data b/tests/suites/test_suite_cipher.aes.data index b987abeb0..2e45ae461 100644 --- a/tests/suites/test_suite_cipher.aes.data +++ b/tests/suites/test_suite_cipher.aes.data @@ -7,259 +7,259 @@ dec_empty_buf: AES Encrypt and decrypt 0 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:0:-1:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:0:-1 AES Encrypt and decrypt 1 byte depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:1:-1 AES Encrypt and decrypt 2 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:2:-1 AES Encrypt and decrypt 7 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:7:-1 AES Encrypt and decrypt 8 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:8:-1 AES Encrypt and decrypt 9 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:9:-1 AES Encrypt and decrypt 15 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:15:-1 AES Encrypt and decrypt 16 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:16:-1 AES Encrypt and decrypt 17 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:17:-1 AES Encrypt and decrypt 31 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:31:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:32:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:33:-1 AES Encrypt and decrypt 47 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:47:-1 AES Encrypt and decrypt 48 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:48:-1 AES Encrypt and decrypt 49 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:49:-1 AES Encrypt and decrypt 0 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:0:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:0:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 1 byte with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:1:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:1:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 2 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:2:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:2:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 7 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:7:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:7:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 8 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:8:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:8:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 9 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:9:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:9:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 15 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:15:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:15:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 16 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:16:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:16:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 17 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:17:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:17:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 31 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:31:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:31:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 32 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:32:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:32:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 33 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:33:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:33:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 47 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:47:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:47:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 48 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:48:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:48:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 49 bytes with one and zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:49:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:49:POLARSSL_PADDING_ONE_AND_ZEROS AES Encrypt and decrypt 0 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:0:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:0:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 1 byte with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:1:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:1:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 2 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:2:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:2:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 7 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:7:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:7:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 8 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:8:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:8:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 9 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:9:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:9:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 15 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:15:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:15:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 16 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:16:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:16:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 17 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:17:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:17:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 31 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:31:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:31:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 32 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:32:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:32:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 33 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:33:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:33:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 47 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:47:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:47:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 48 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:48:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:48:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 49 bytes with zeros and len padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:49:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:49:POLARSSL_PADDING_ZEROS_AND_LEN AES Encrypt and decrypt 0 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:0:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:0:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 1 byte with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:1:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:1:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 2 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:2:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:2:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 7 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:7:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:7:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 8 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:8:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:8:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 9 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:9:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:9:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 15 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:15:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:15:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 16 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:16:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:16:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 17 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:17:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:17:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 31 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:31:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:31:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 32 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:32:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:32:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 33 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:33:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:33:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 47 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:47:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:47:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 48 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:48:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:48:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 49 bytes with zeros padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:49:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:49:POLARSSL_PADDING_ZEROS AES Encrypt and decrypt 0 bytes with no padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:0:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:0:POLARSSL_PADDING_NONE AES Encrypt and decrypt 16 bytes with no padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:16:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:16:POLARSSL_PADDING_NONE AES Encrypt and decrypt 32 bytes with no padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:32:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:32:POLARSSL_PADDING_NONE AES Encrypt and decrypt 48 bytes with no padding depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:AES-128-CBC:128:48:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_AES_128_CBC:"AES-128-CBC":128:48:POLARSSL_PADDING_NONE AES Try encrypting 1 bytes with no padding depends_on:POLARSSL_AES_C @@ -351,63 +351,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_AES_128_CBC:128:16:16: AES Encrypt and decrypt 0 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:0:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:0:-1 AES Encrypt and decrypt 1 byte depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:1:-1 AES Encrypt and decrypt 2 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:2:-1 AES Encrypt and decrypt 7 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:7:-1 AES Encrypt and decrypt 8 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:8:-1 AES Encrypt and decrypt 9 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:9:-1 AES Encrypt and decrypt 15 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:15:-1 AES Encrypt and decrypt 16 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:16:-1 AES Encrypt and decrypt 17 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:17:-1 AES Encrypt and decrypt 31 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:31:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:32:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:33:-1 AES Encrypt and decrypt 47 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:47:-1 AES Encrypt and decrypt 48 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:48:-1 AES Encrypt and decrypt 49 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:AES-128-CFB128:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CFB128:"AES-128-CFB128":128:49:-1 AES Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CFB @@ -455,63 +455,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_AES_128_CFB128:128:16:16: AES Encrypt and decrypt 0 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:0:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:0:-1 AES Encrypt and decrypt 1 byte depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:1:-1 AES Encrypt and decrypt 2 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:2:-1 AES Encrypt and decrypt 7 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:7:-1 AES Encrypt and decrypt 8 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:8:-1 AES Encrypt and decrypt 9 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:9:-1 AES Encrypt and decrypt 15 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:15:-1 AES Encrypt and decrypt 16 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:16:-1 AES Encrypt and decrypt 17 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:17:-1 AES Encrypt and decrypt 31 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:31:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:32:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:33:-1 AES Encrypt and decrypt 47 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:47:-1 AES Encrypt and decrypt 48 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:48:-1 AES Encrypt and decrypt 49 bytes depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:AES-128-CTR:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_128_CTR:"AES-128-CTR":128:49:-1 AES Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_AES_C:POLARSSL_CIPHER_MODE_CTR @@ -559,63 +559,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_AES_128_CTR:128:16:16: AES Encrypt and decrypt 0 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:0:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:0:-1 AES Encrypt and decrypt 1 byte depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:1:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:1:-1 AES Encrypt and decrypt 2 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:2:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:2:-1 AES Encrypt and decrypt 7 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:7:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:7:-1 AES Encrypt and decrypt 8 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:8:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:8:-1 AES Encrypt and decrypt 9 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:9:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:9:-1 AES Encrypt and decrypt 15 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:15:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:15:-1 AES Encrypt and decrypt 16 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:16:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:16:-1 AES Encrypt and decrypt 17 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:17:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:17:-1 AES Encrypt and decrypt 31 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:31:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:31:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:32:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:32:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:33:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:33:-1 AES Encrypt and decrypt 47 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:47:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:47:-1 AES Encrypt and decrypt 48 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:48:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:48:-1 AES Encrypt and decrypt 49 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:AES-192-CBC:192:49:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_192_CBC:"AES-192-CBC":192:49:-1 AES Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_AES_C @@ -663,63 +663,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_AES_192_CBC:192:16:16: AES Encrypt and decrypt 0 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:0:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:0:-1 AES Encrypt and decrypt 1 byte depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:1:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:1:-1 AES Encrypt and decrypt 2 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:2:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:2:-1 AES Encrypt and decrypt 7 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:7:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:7:-1 AES Encrypt and decrypt 8 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:8:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:8:-1 AES Encrypt and decrypt 9 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:9:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:9:-1 AES Encrypt and decrypt 15 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:15:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:15:-1 AES Encrypt and decrypt 16 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:16:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:16:-1 AES Encrypt and decrypt 17 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:17:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:17:-1 AES Encrypt and decrypt 31 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:31:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:31:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:32:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:32:-1 AES Encrypt and decrypt 32 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:33:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:33:-1 AES Encrypt and decrypt 47 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:47:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:47:-1 AES Encrypt and decrypt 48 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:48:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:48:-1 AES Encrypt and decrypt 49 bytes depends_on:POLARSSL_AES_C -enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:AES-256-CBC:256:49:-1 +enc_dec_buf:POLARSSL_CIPHER_AES_256_CBC:"AES-256-CBC":256:49:-1 AES Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_AES_C diff --git a/tests/suites/test_suite_cipher.blowfish.data b/tests/suites/test_suite_cipher.blowfish.data index 4ecf77408..ac1ab10fb 100644 --- a/tests/suites/test_suite_cipher.blowfish.data +++ b/tests/suites/test_suite_cipher.blowfish.data @@ -7,263 +7,263 @@ dec_empty_buf: BLOWFISH Encrypt and decrypt 0 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:0:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:0:-1 BLOWFISH Encrypt and decrypt 1 byte depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:1:-1 BLOWFISH Encrypt and decrypt 2 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:2:-1 BLOWFISH Encrypt and decrypt 7 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:7:-1 BLOWFISH Encrypt and decrypt 8 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:8:-1 BLOWFISH Encrypt and decrypt 9 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:9:-1 BLOWFISH Encrypt and decrypt 15 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:15:-1 BLOWFISH Encrypt and decrypt 16 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:16:-1 BLOWFISH Encrypt and decrypt 17 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:17:-1 BLOWFISH Encrypt and decrypt 31 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:31:-1 BLOWFISH Encrypt and decrypt 32 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:32:-1 BLOWFISH Encrypt and decrypt 32 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:33:-1 BLOWFISH Encrypt and decrypt 47 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:47:-1 BLOWFISH Encrypt and decrypt 48 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:48:-1 BLOWFISH Encrypt and decrypt 49 bytes depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:49:-1 BLOWFISH Encrypt and decrypt 0 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:0:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:0:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 1 byte with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:1:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:1:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 2 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:2:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:2:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 7 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:7:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:7:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 8 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:8:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:8:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 9 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:9:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:9:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 15 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:15:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:15:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 16 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:16:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:16:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 17 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:17:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:17:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 31 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:31:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:31:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 32 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:32:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:32:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 32 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:33:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:33:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 47 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:47:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:47:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 48 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:48:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:48:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 49 bytes with one and zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:49:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:49:POLARSSL_PADDING_ONE_AND_ZEROS BLOWFISH Encrypt and decrypt 0 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:0:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:0:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 1 byte with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:1:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:1:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 2 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:2:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:2:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 7 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:7:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:7:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 8 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:8:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:8:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 9 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:9:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:9:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 15 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:15:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:15:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 16 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:16:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:16:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 17 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:17:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:17:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 31 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:31:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:31:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 32 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:32:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:32:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 32 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:33:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:33:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 47 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:47:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:47:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 48 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:48:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:48:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 49 bytes with zeros and len padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:49:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:49:POLARSSL_PADDING_ZEROS_AND_LEN BLOWFISH Encrypt and decrypt 0 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:0:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:0:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 1 byte with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:1:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:1:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 2 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:2:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:2:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 7 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:7:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:7:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 8 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:8:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:8:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 9 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:9:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:9:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 15 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:15:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:15:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 16 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:16:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:16:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 17 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:17:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:17:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 31 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:31:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:31:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 32 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:32:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:32:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 32 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:33:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:33:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 47 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:47:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:47:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 48 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:48:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:48:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 49 bytes with zeros padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:49:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:49:POLARSSL_PADDING_ZEROS BLOWFISH Encrypt and decrypt 0 bytes with no padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:0:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:0:POLARSSL_PADDING_NONE BLOWFISH Encrypt and decrypt 8 bytes with no padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:8:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:8:POLARSSL_PADDING_NONE BLOWFISH Encrypt and decrypt 16 bytes with no padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:16:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:16:POLARSSL_PADDING_NONE BLOWFISH Encrypt and decrypt 32 bytes with no padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:32:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:32:POLARSSL_PADDING_NONE BLOWFISH Encrypt and decrypt 48 bytes with no padding depends_on:POLARSSL_BLOWFISH_C -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:BLOWFISH-CBC:128:48:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CBC:"BLOWFISH-CBC":128:48:POLARSSL_PADDING_NONE BLOWFISH Try encrypting 1 bytes with no padding depends_on:POLARSSL_BLOWFISH_C @@ -351,63 +351,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_BLOWFISH_CBC:128:16:16: BLOWFISH Encrypt and decrypt 0 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:0:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:0:-1 BLOWFISH Encrypt and decrypt 1 byte depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:1:-1 BLOWFISH Encrypt and decrypt 2 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:2:-1 BLOWFISH Encrypt and decrypt 7 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:7:-1 BLOWFISH Encrypt and decrypt 8 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:8:-1 BLOWFISH Encrypt and decrypt 9 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:9:-1 BLOWFISH Encrypt and decrypt 15 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:15:-1 BLOWFISH Encrypt and decrypt 16 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:16:-1 BLOWFISH Encrypt and decrypt 17 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:17:-1 BLOWFISH Encrypt and decrypt 31 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:31:-1 BLOWFISH Encrypt and decrypt 32 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:32:-1 BLOWFISH Encrypt and decrypt 32 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:33:-1 BLOWFISH Encrypt and decrypt 47 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:47:-1 BLOWFISH Encrypt and decrypt 48 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:48:-1 BLOWFISH Encrypt and decrypt 49 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:BLOWFISH-CFB64:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CFB64:"BLOWFISH-CFB64":128:49:-1 BLOWFISH Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CFB @@ -455,63 +455,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_BLOWFISH_CFB64:128:16:16: BLOWFISH Encrypt and decrypt 0 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:0:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:0:-1 BLOWFISH Encrypt and decrypt 1 byte depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:1:-1 BLOWFISH Encrypt and decrypt 2 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:2:-1 BLOWFISH Encrypt and decrypt 7 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:7:-1 BLOWFISH Encrypt and decrypt 8 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:8:-1 BLOWFISH Encrypt and decrypt 9 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:9:-1 BLOWFISH Encrypt and decrypt 15 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:15:-1 BLOWFISH Encrypt and decrypt 16 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:16:-1 BLOWFISH Encrypt and decrypt 17 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:17:-1 BLOWFISH Encrypt and decrypt 31 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:31:-1 BLOWFISH Encrypt and decrypt 32 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:32:-1 BLOWFISH Encrypt and decrypt 32 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:33:-1 BLOWFISH Encrypt and decrypt 47 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:47:-1 BLOWFISH Encrypt and decrypt 48 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:48:-1 BLOWFISH Encrypt and decrypt 49 bytes depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:BLOWFISH-CTR:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_BLOWFISH_CTR:"BLOWFISH-CTR":128:49:-1 BLOWFISH Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_BLOWFISH_C:POLARSSL_CIPHER_MODE_CTR diff --git a/tests/suites/test_suite_cipher.camellia.data b/tests/suites/test_suite_cipher.camellia.data index ecf1b9118..84fe20e8c 100644 --- a/tests/suites/test_suite_cipher.camellia.data +++ b/tests/suites/test_suite_cipher.camellia.data @@ -7,259 +7,259 @@ dec_empty_buf: CAMELLIA Encrypt and decrypt 0 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:0:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:0:-1 CAMELLIA Encrypt and decrypt 1 byte depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:1:-1 CAMELLIA Encrypt and decrypt 2 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:2:-1 CAMELLIA Encrypt and decrypt 7 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:7:-1 CAMELLIA Encrypt and decrypt 8 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:8:-1 CAMELLIA Encrypt and decrypt 9 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:9:-1 CAMELLIA Encrypt and decrypt 15 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:15:-1 CAMELLIA Encrypt and decrypt 16 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:16:-1 CAMELLIA Encrypt and decrypt 17 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:17:-1 CAMELLIA Encrypt and decrypt 31 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:31:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:32:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:33:-1 CAMELLIA Encrypt and decrypt 47 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:47:-1 CAMELLIA Encrypt and decrypt 48 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:48:-1 CAMELLIA Encrypt and decrypt 49 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:49:-1 CAMELLIA Encrypt and decrypt 0 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:0:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:0:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 1 byte with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:1:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:1:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 2 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:2:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:2:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 7 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:7:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:7:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 8 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:8:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:8:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 9 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:9:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:9:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 15 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:15:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:15:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 16 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:16:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:16:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 17 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:17:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:17:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 31 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:31:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:31:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 32 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:32:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:32:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 32 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:33:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:33:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 47 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:47:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:47:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 48 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:48:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:48:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 49 bytes with one and zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:49:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:49:POLARSSL_PADDING_ONE_AND_ZEROS CAMELLIA Encrypt and decrypt 0 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:0:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:0:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 1 byte with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:1:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:1:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 2 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:2:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:2:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 7 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:7:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:7:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 8 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:8:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:8:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 9 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:9:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:9:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 15 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:15:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:15:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 16 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:16:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:16:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 17 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:17:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:17:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 31 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:31:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:31:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 32 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:32:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:32:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 32 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:33:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:33:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 47 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:47:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:47:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 48 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:48:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:48:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 49 bytes with zeros and len padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:49:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:49:POLARSSL_PADDING_ZEROS_AND_LEN CAMELLIA Encrypt and decrypt 0 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:0:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:0:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 1 byte with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:1:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:1:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 2 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:2:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:2:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 7 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:7:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:7:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 8 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:8:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:8:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 9 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:9:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:9:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 15 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:15:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:15:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 16 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:16:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:16:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 17 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:17:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:17:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 31 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:31:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:31:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 32 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:32:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:32:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 32 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:33:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:33:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 47 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:47:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:47:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 48 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:48:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:48:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 49 bytes with zeros padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:49:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:49:POLARSSL_PADDING_ZEROS CAMELLIA Encrypt and decrypt 0 bytes with no padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:0:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:0:POLARSSL_PADDING_NONE CAMELLIA Encrypt and decrypt 16 bytes with no padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:16:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:16:POLARSSL_PADDING_NONE CAMELLIA Encrypt and decrypt 32 bytes with no padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:32:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:32:POLARSSL_PADDING_NONE CAMELLIA Encrypt and decrypt 48 bytes with no padding depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:CAMELLIA-128-CBC:128:48:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CBC:"CAMELLIA-128-CBC":128:48:POLARSSL_PADDING_NONE CAMELLIA Try encrypting 1 bytes with no padding depends_on:POLARSSL_CAMELLIA_C @@ -351,63 +351,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_CAMELLIA_128_CBC:128:16:16: CAMELLIA Encrypt and decrypt 0 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:0:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:0:-1 CAMELLIA Encrypt and decrypt 1 byte depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:1:-1 CAMELLIA Encrypt and decrypt 2 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:2:-1 CAMELLIA Encrypt and decrypt 7 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:7:-1 CAMELLIA Encrypt and decrypt 8 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:8:-1 CAMELLIA Encrypt and decrypt 9 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:9:-1 CAMELLIA Encrypt and decrypt 15 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:15:-1 CAMELLIA Encrypt and decrypt 16 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:16:-1 CAMELLIA Encrypt and decrypt 17 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:17:-1 CAMELLIA Encrypt and decrypt 31 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:31:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:32:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:33:-1 CAMELLIA Encrypt and decrypt 47 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:47:-1 CAMELLIA Encrypt and decrypt 48 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:48:-1 CAMELLIA Encrypt and decrypt 49 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:CAMELLIA-128-CFB128:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CFB128:"CAMELLIA-128-CFB128":128:49:-1 CAMELLIA Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CFB @@ -455,63 +455,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_CAMELLIA_128_CFB128:128:16:16: CAMELLIA Encrypt and decrypt 0 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:0:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:0:-1 CAMELLIA Encrypt and decrypt 1 byte depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:1:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:1:-1 CAMELLIA Encrypt and decrypt 2 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:2:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:2:-1 CAMELLIA Encrypt and decrypt 7 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:7:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:7:-1 CAMELLIA Encrypt and decrypt 8 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:8:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:8:-1 CAMELLIA Encrypt and decrypt 9 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:9:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:9:-1 CAMELLIA Encrypt and decrypt 15 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:15:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:15:-1 CAMELLIA Encrypt and decrypt 16 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:16:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:16:-1 CAMELLIA Encrypt and decrypt 17 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:17:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:17:-1 CAMELLIA Encrypt and decrypt 31 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:31:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:31:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:32:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:32:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:33:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:33:-1 CAMELLIA Encrypt and decrypt 47 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:47:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:47:-1 CAMELLIA Encrypt and decrypt 48 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:48:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:48:-1 CAMELLIA Encrypt and decrypt 49 bytes depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:CAMELLIA-128-CTR:128:49:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_128_CTR:"CAMELLIA-128-CTR":128:49:-1 CAMELLIA Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_CAMELLIA_C:POLARSSL_CIPHER_MODE_CTR @@ -559,63 +559,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_CAMELLIA_128_CTR:128:16:16: CAMELLIA Encrypt and decrypt 0 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:0:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:0:-1 CAMELLIA Encrypt and decrypt 1 byte depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:1:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:1:-1 CAMELLIA Encrypt and decrypt 2 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:2:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:2:-1 CAMELLIA Encrypt and decrypt 7 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:7:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:7:-1 CAMELLIA Encrypt and decrypt 8 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:8:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:8:-1 CAMELLIA Encrypt and decrypt 9 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:9:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:9:-1 CAMELLIA Encrypt and decrypt 15 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:15:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:15:-1 CAMELLIA Encrypt and decrypt 16 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:16:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:16:-1 CAMELLIA Encrypt and decrypt 17 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:17:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:17:-1 CAMELLIA Encrypt and decrypt 31 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:31:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:31:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:32:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:32:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:33:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:33:-1 CAMELLIA Encrypt and decrypt 47 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:47:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:47:-1 CAMELLIA Encrypt and decrypt 48 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:48:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:48:-1 CAMELLIA Encrypt and decrypt 49 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:CAMELLIA-192-CBC:192:49:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_192_CBC:"CAMELLIA-192-CBC":192:49:-1 CAMELLIA Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_CAMELLIA_C @@ -663,63 +663,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_CAMELLIA_192_CBC:192:16:16: CAMELLIA Encrypt and decrypt 0 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:0:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:0:-1 CAMELLIA Encrypt and decrypt 1 byte depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:1:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:1:-1 CAMELLIA Encrypt and decrypt 2 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:2:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:2:-1 CAMELLIA Encrypt and decrypt 7 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:7:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:7:-1 CAMELLIA Encrypt and decrypt 8 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:8:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:8:-1 CAMELLIA Encrypt and decrypt 9 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:9:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:9:-1 CAMELLIA Encrypt and decrypt 15 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:15:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:15:-1 CAMELLIA Encrypt and decrypt 16 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:16:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:16:-1 CAMELLIA Encrypt and decrypt 17 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:17:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:17:-1 CAMELLIA Encrypt and decrypt 31 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:31:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:31:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:32:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:32:-1 CAMELLIA Encrypt and decrypt 32 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:33:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:33:-1 CAMELLIA Encrypt and decrypt 47 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:47:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:47:-1 CAMELLIA Encrypt and decrypt 48 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:48:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:48:-1 CAMELLIA Encrypt and decrypt 49 bytes depends_on:POLARSSL_CAMELLIA_C -enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:CAMELLIA-256-CBC:256:49:-1 +enc_dec_buf:POLARSSL_CIPHER_CAMELLIA_256_CBC:"CAMELLIA-256-CBC":256:49:-1 CAMELLIA Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_CAMELLIA_C diff --git a/tests/suites/test_suite_cipher.des.data b/tests/suites/test_suite_cipher.des.data index 65ec3d16a..01da02c49 100644 --- a/tests/suites/test_suite_cipher.des.data +++ b/tests/suites/test_suite_cipher.des.data @@ -7,263 +7,263 @@ dec_empty_buf: DES Encrypt and decrypt 0 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:0:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:0:-1 DES Encrypt and decrypt 1 byte depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:1:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:1:-1 DES Encrypt and decrypt 2 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:2:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:2:-1 DES Encrypt and decrypt 7 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:7:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:7:-1 DES Encrypt and decrypt 8 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:8:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:8:-1 DES Encrypt and decrypt 9 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:9:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:9:-1 DES Encrypt and decrypt 15 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:15:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:15:-1 DES Encrypt and decrypt 16 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:16:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:16:-1 DES Encrypt and decrypt 17 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:17:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:17:-1 DES Encrypt and decrypt 31 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:31:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:31:-1 DES Encrypt and decrypt 32 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:32:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:32:-1 DES Encrypt and decrypt 32 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:33:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:33:-1 DES Encrypt and decrypt 47 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:47:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:47:-1 DES Encrypt and decrypt 48 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:48:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:48:-1 DES Encrypt and decrypt 49 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:49:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:49:-1 DES Encrypt and decrypt 0 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:0:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:0:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 1 byte with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:1:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:1:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 2 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:2:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:2:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 7 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:7:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:7:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 8 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:8:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:8:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 9 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:9:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:9:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 15 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:15:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:15:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 16 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:16:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:16:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 17 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:17:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:17:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 31 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:31:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:31:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 32 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:32:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:32:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 32 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:33:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:33:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 47 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:47:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:47:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 48 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:48:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:48:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 49 bytes with one and zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:49:POLARSSL_PADDING_ONE_AND_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:49:POLARSSL_PADDING_ONE_AND_ZEROS DES Encrypt and decrypt 0 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:0:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:0:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 1 byte with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:1:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:1:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 2 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:2:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:2:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 7 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:7:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:7:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 8 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:8:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:8:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 9 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:9:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:9:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 15 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:15:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:15:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 16 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:16:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:16:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 17 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:17:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:17:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 31 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:31:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:31:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 32 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:32:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:32:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 32 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:33:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:33:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 47 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:47:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:47:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 48 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:48:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:48:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 49 bytes with zeros and len padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:49:POLARSSL_PADDING_ZEROS_AND_LEN +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:49:POLARSSL_PADDING_ZEROS_AND_LEN DES Encrypt and decrypt 0 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:0:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:0:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 1 byte with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:1:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:1:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 2 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:2:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:2:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 7 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:7:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:7:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 8 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:8:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:8:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 9 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:9:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:9:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 15 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:15:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:15:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 16 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:16:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:16:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 17 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:17:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:17:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 31 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:31:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:31:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 32 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:32:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:32:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 32 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:33:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:33:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 47 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:47:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:47:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 48 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:48:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:48:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 49 bytes with zeros padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:49:POLARSSL_PADDING_ZEROS +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:49:POLARSSL_PADDING_ZEROS DES Encrypt and decrypt 0 bytes with no padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:0:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:0:POLARSSL_PADDING_NONE DES Encrypt and decrypt 8 bytes with no padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:8:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:8:POLARSSL_PADDING_NONE DES Encrypt and decrypt 16 bytes with no padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:16:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:16:POLARSSL_PADDING_NONE DES Encrypt and decrypt 32 bytes with no padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:32:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:32:POLARSSL_PADDING_NONE DES Encrypt and decrypt 48 bytes with no padding depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_CBC:DES-CBC:56:48:POLARSSL_PADDING_NONE +enc_dec_buf:POLARSSL_CIPHER_DES_CBC:"DES-CBC":56:48:POLARSSL_PADDING_NONE DES Try encrypting 1 bytes with no padding depends_on:POLARSSL_DES_C @@ -351,63 +351,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_DES_CBC:56:16:16: DES Encrypt and decrypt 0 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:0:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:0:-1 DES3 Encrypt and decrypt 1 byte depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:1:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:1:-1 DES3 Encrypt and decrypt 2 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:2:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:2:-1 DES3 Encrypt and decrypt 7 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:7:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:7:-1 DES3 Encrypt and decrypt 8 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:8:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:8:-1 DES3 Encrypt and decrypt 9 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:9:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:9:-1 DES3 Encrypt and decrypt 15 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:15:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:15:-1 DES3 Encrypt and decrypt 16 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:16:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:16:-1 DES3 Encrypt and decrypt 17 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:17:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:17:-1 DES3 Encrypt and decrypt 31 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:31:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:31:-1 DES3 Encrypt and decrypt 32 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:32:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:32:-1 DES3 Encrypt and decrypt 32 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:33:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:33:-1 DES3 Encrypt and decrypt 47 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:47:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:47:-1 DES3 Encrypt and decrypt 48 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:48:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:48:-1 DES3 Encrypt and decrypt 49 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:DES-EDE-CBC:112:49:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE_CBC:"DES-EDE-CBC":112:49:-1 DES3 Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_DES_C @@ -455,63 +455,63 @@ enc_dec_buf_multipart:POLARSSL_CIPHER_DES_EDE_CBC:112:16:16: DES3 Encrypt and decrypt 0 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:0:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:0:-1 DES3 Encrypt and decrypt 1 byte depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:1:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:1:-1 DES3 Encrypt and decrypt 2 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:2:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:2:-1 DES3 Encrypt and decrypt 7 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:7:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:7:-1 DES3 Encrypt and decrypt 8 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:8:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:8:-1 DES3 Encrypt and decrypt 9 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:9:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:9:-1 DES3 Encrypt and decrypt 15 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:15:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:15:-1 DES3 Encrypt and decrypt 16 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:16:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:16:-1 DES3 Encrypt and decrypt 17 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:17:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:17:-1 DES3 Encrypt and decrypt 31 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:31:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:31:-1 DES3 Encrypt and decrypt 32 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:32:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:32:-1 DES3 Encrypt and decrypt 32 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:33:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:33:-1 DES3 Encrypt and decrypt 47 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:47:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:47:-1 DES3 Encrypt and decrypt 48 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:48:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:48:-1 DES3 Encrypt and decrypt 49 bytes depends_on:POLARSSL_DES_C -enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:DES-EDE3-CBC:168:49:-1 +enc_dec_buf:POLARSSL_CIPHER_DES_EDE3_CBC:"DES-EDE3-CBC":168:49:-1 DES3 Encrypt and decrypt 0 bytes in multiple parts depends_on:POLARSSL_DES_C diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function index 4f3720018..1f7943a44 100644 --- a/tests/suites/test_suite_cipher.function +++ b/tests/suites/test_suite_cipher.function @@ -1,14 +1,17 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_CIPHER_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_CIPHER_C + * END_DEPENDENCIES + */ -BEGIN_CASE -enc_dec_buf:cipher_id:cipher_string:key_len:length:pad_mode: - size_t length = {length}; +/* BEGIN_CASE */ +void enc_dec_buf( int cipher_id, char *cipher_string, int key_len, + int length_val, int pad_mode ) +{ + size_t length = length_val; unsigned char key[32]; unsigned char iv[16]; @@ -34,21 +37,21 @@ enc_dec_buf:cipher_id:cipher_string:key_len:length:pad_mode: memset( decbuf, 0, 64 ); /* Check and get info structures */ - cipher_info = cipher_info_from_type( {cipher_id} ); + cipher_info = cipher_info_from_type( cipher_id ); TEST_ASSERT( NULL != cipher_info ); - TEST_ASSERT( cipher_info_from_string( "{cipher_string}" ) == cipher_info ); + TEST_ASSERT( cipher_info_from_string( cipher_string ) == cipher_info ); /* Initialise enc and dec contexts */ TEST_ASSERT( 0 == cipher_init_ctx( &ctx_dec, cipher_info ) ); TEST_ASSERT( 0 == cipher_init_ctx( &ctx_enc, cipher_info ) ); - TEST_ASSERT( 0 == cipher_setkey( &ctx_dec, key, {key_len}, POLARSSL_DECRYPT ) ); - TEST_ASSERT( 0 == cipher_setkey( &ctx_enc, key, {key_len}, POLARSSL_ENCRYPT ) ); + TEST_ASSERT( 0 == cipher_setkey( &ctx_dec, key, key_len, POLARSSL_DECRYPT ) ); + TEST_ASSERT( 0 == cipher_setkey( &ctx_enc, key, key_len, POLARSSL_ENCRYPT ) ); - if( -1 != {pad_mode} ) + if( -1 != pad_mode ) { - TEST_ASSERT( 0 == cipher_set_padding_mode( &ctx_dec, {pad_mode} ) ); - TEST_ASSERT( 0 == cipher_set_padding_mode( &ctx_enc, {pad_mode} ) ); + TEST_ASSERT( 0 == cipher_set_padding_mode( &ctx_dec, pad_mode ) ); + TEST_ASSERT( 0 == cipher_set_padding_mode( &ctx_enc, pad_mode ) ); } TEST_ASSERT( 0 == cipher_reset( &ctx_dec, iv ) ); @@ -89,11 +92,14 @@ enc_dec_buf:cipher_id:cipher_string:key_len:length:pad_mode: TEST_ASSERT( 0 == cipher_free_ctx( &ctx_dec ) ); TEST_ASSERT( 0 == cipher_free_ctx( &ctx_enc ) ); -END_CASE +} +/* END_CASE */ -BEGIN_CASE -enc_fail:cipher_id:pad_mode:key_len:length:ret: - size_t length = {length}; +/* BEGIN_CASE */ +void enc_fail( int cipher_id, int pad_mode, int key_len, + int length_val, int ret ) +{ + size_t length = length_val; unsigned char key[32]; unsigned char iv[16]; @@ -114,25 +120,27 @@ enc_fail:cipher_id:pad_mode:key_len:length:ret: memset( encbuf, 0, 64 ); /* Check and get info structures */ - cipher_info = cipher_info_from_type( {cipher_id} ); + cipher_info = cipher_info_from_type( cipher_id ); TEST_ASSERT( NULL != cipher_info ); /* Initialise context */ TEST_ASSERT( 0 == cipher_init_ctx( &ctx, cipher_info ) ); - TEST_ASSERT( 0 == cipher_setkey( &ctx, key, {key_len}, POLARSSL_ENCRYPT ) ); - TEST_ASSERT( 0 == cipher_set_padding_mode( &ctx, {pad_mode} ) ); + TEST_ASSERT( 0 == cipher_setkey( &ctx, key, key_len, POLARSSL_ENCRYPT ) ); + TEST_ASSERT( 0 == cipher_set_padding_mode( &ctx, pad_mode ) ); TEST_ASSERT( 0 == cipher_reset( &ctx, iv ) ); /* encode length number of bytes from inbuf */ TEST_ASSERT( 0 == cipher_update( &ctx, inbuf, length, encbuf, &outlen ) ); - TEST_ASSERT( {ret} == cipher_finish( &ctx, encbuf + outlen, &outlen ) ); + TEST_ASSERT( ret == cipher_finish( &ctx, encbuf + outlen, &outlen ) ); /* done */ TEST_ASSERT( 0 == cipher_free_ctx( &ctx ) ); -END_CASE +} +/* END_CASE */ -BEGIN_CASE -dec_empty_buf: +/* BEGIN_CASE */ +void dec_empty_buf() +{ unsigned char key[32]; unsigned char iv[16]; @@ -169,12 +177,15 @@ dec_empty_buf: TEST_ASSERT( 0 == outlen ); TEST_ASSERT( 0 == cipher_free_ctx( &ctx_dec ) ); -END_CASE +} +/* END_CASE */ -BEGIN_CASE -enc_dec_buf_multipart:cipher_id:key_len:first_length:second_length: - size_t first_length = {first_length}; - size_t second_length = {second_length}; +/* BEGIN_CASE */ +void enc_dec_buf_multipart( int cipher_id, int key_len, int first_length_val, + int second_length_val ) +{ + size_t first_length = first_length_val; + size_t second_length = second_length_val; size_t length = first_length + second_length; unsigned char key[32]; unsigned char iv[16]; @@ -201,14 +212,14 @@ enc_dec_buf_multipart:cipher_id:key_len:first_length:second_length: memset( decbuf, 0, 64 ); /* Initialise enc and dec contexts */ - cipher_info = cipher_info_from_type( {cipher_id} ); + cipher_info = cipher_info_from_type( cipher_id ); TEST_ASSERT( NULL != cipher_info); TEST_ASSERT( 0 == cipher_init_ctx( &ctx_dec, cipher_info ) ); TEST_ASSERT( 0 == cipher_init_ctx( &ctx_enc, cipher_info ) ); - TEST_ASSERT( 0 == cipher_setkey( &ctx_dec, key, {key_len}, POLARSSL_DECRYPT ) ); - TEST_ASSERT( 0 == cipher_setkey( &ctx_enc, key, {key_len}, POLARSSL_ENCRYPT ) ); + TEST_ASSERT( 0 == cipher_setkey( &ctx_dec, key, key_len, POLARSSL_DECRYPT ) ); + TEST_ASSERT( 0 == cipher_setkey( &ctx_enc, key, key_len, POLARSSL_ENCRYPT ) ); TEST_ASSERT( 0 == cipher_reset( &ctx_dec, iv ) ); TEST_ASSERT( 0 == cipher_reset( &ctx_enc, iv ) ); @@ -248,24 +259,28 @@ enc_dec_buf_multipart:cipher_id:key_len:first_length:second_length: TEST_ASSERT( 0 == cipher_free_ctx( &ctx_dec ) ); TEST_ASSERT( 0 == cipher_free_ctx( &ctx_enc ) ); -END_CASE +} +/* END_CASE */ -BEGIN_CASE -set_padding:cipher_id:pad_mode:ret: +/* BEGIN_CASE */ +void set_padding( int cipher_id, int pad_mode, int ret ) +{ const cipher_info_t *cipher_info; cipher_context_t ctx; - cipher_info = cipher_info_from_type( {cipher_id} ); + cipher_info = cipher_info_from_type( cipher_id ); TEST_ASSERT( NULL != cipher_info ); TEST_ASSERT( 0 == cipher_init_ctx( &ctx, cipher_info ) ); - TEST_ASSERT( {ret} == cipher_set_padding_mode( &ctx, {pad_mode} ) ); + TEST_ASSERT( ret == cipher_set_padding_mode( &ctx, pad_mode ) ); TEST_ASSERT( 0 == cipher_free_ctx( &ctx ) ); -END_CASE +} +/* END_CASE */ -BEGIN_CASE -check_padding:pad_mode:input:ret:dlen: +/* BEGIN_CASE */ +void check_padding( int pad_mode, char *input_str, int ret, int dlen_check ) +{ cipher_info_t cipher_info; cipher_context_t ctx; unsigned char input[16]; @@ -276,18 +291,19 @@ check_padding:pad_mode:input:ret:dlen: cipher_info.mode = POLARSSL_MODE_CBC; ctx.cipher_info = &cipher_info; - TEST_ASSERT( 0 == cipher_set_padding_mode( &ctx, {pad_mode} ) ); + TEST_ASSERT( 0 == cipher_set_padding_mode( &ctx, pad_mode ) ); - ilen = unhexify( input, {input} ); + ilen = unhexify( input, input_str ); - TEST_ASSERT( {ret} == ctx.get_padding( input, ilen, &dlen ) ); - if( 0 == {ret} ) - TEST_ASSERT( dlen == {dlen} ); -END_CASE + TEST_ASSERT( ret == ctx.get_padding( input, ilen, &dlen ) ); + if( 0 == ret ) + TEST_ASSERT( dlen == (size_t) dlen_check ); +} +/* END_CASE */ -BEGIN_CASE -cipher_selftest: +/* BEGIN_CASE */ +void cipher_selftest() { TEST_ASSERT( cipher_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_ctr_drbg.function b/tests/suites/test_suite_ctr_drbg.function index 110eb8cef..b11a7d0bf 100644 --- a/tests/suites/test_suite_ctr_drbg.function +++ b/tests/suites/test_suite_ctr_drbg.function @@ -1,4 +1,4 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include int test_offset; @@ -9,14 +9,17 @@ int entropy_func( void *data, unsigned char *buf, size_t len ) test_offset += 32; return( 0 ); } -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_CTR_DRBG_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_CTR_DRBG_C + * END_DEPENDENCIES + */ -BEGIN_CASE -ctr_drbg_validate_pr:add_init_string:entropy_string:add1_string:add2_string:result_str +/* BEGIN_CASE */ +void ctr_drbg_validate_pr( char *add_init_string, char *entropy_string, + char *add1_string, char *add2_string, + char *result_str ) { unsigned char entropy[512]; unsigned char add_init[512]; @@ -29,10 +32,10 @@ ctr_drbg_validate_pr:add_init_string:entropy_string:add1_string:add2_string:resu memset( output_str, 0, 512 ); - unhexify( entropy, {entropy_string} ); - add_init_len = unhexify( add_init, {add_init_string} ); - add1_len = unhexify( add1, {add1_string} ); - add2_len = unhexify( add2, {add2_string} ); + unhexify( entropy, entropy_string ); + add_init_len = unhexify( add_init, add_init_string ); + add1_len = unhexify( add1, add1_string ); + add2_len = unhexify( add2, add2_string ); test_offset = 0; TEST_ASSERT( ctr_drbg_init_entropy_len( &ctx, entropy_func, entropy, add_init, add_init_len, 32 ) == 0 ); @@ -41,12 +44,14 @@ ctr_drbg_validate_pr:add_init_string:entropy_string:add1_string:add2_string:resu TEST_ASSERT( ctr_drbg_random_with_add( &ctx, buf, 16, add1, add1_len ) == 0 ); TEST_ASSERT( ctr_drbg_random_with_add( &ctx, buf, 16, add2, add2_len ) == 0 ); hexify( output_str, buf, 16 ); - TEST_ASSERT( strcmp( (char *) output_str, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( (char *) output_str, result_str ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ctr_drbg_validate_nopr:add_init_string:entropy_string:add1_string:add_reseed_string:add2_string:result_str +/* BEGIN_CASE */ +void ctr_drbg_validate_nopr( char *add_init_string, char *entropy_string, + char *add1_string, char *add_reseed_string, + char *add2_string, char *result_str ) { unsigned char entropy[512]; unsigned char add_init[512]; @@ -60,11 +65,11 @@ ctr_drbg_validate_nopr:add_init_string:entropy_string:add1_string:add_reseed_str memset( output_str, 0, 512 ); - unhexify( entropy, {entropy_string} ); - add_init_len = unhexify( add_init, {add_init_string} ); - add1_len = unhexify( add1, {add1_string} ); - add_reseed_len = unhexify( add_reseed, {add_reseed_string} ); - add2_len = unhexify( add2, {add2_string} ); + unhexify( entropy, entropy_string ); + add_init_len = unhexify( add_init, add_init_string ); + add1_len = unhexify( add1, add1_string ); + add_reseed_len = unhexify( add_reseed, add_reseed_string ); + add2_len = unhexify( add2, add2_string ); test_offset = 0; TEST_ASSERT( ctr_drbg_init_entropy_len( &ctx, entropy_func, entropy, add_init, add_init_len, 32 ) == 0 ); @@ -73,6 +78,6 @@ ctr_drbg_validate_nopr:add_init_string:entropy_string:add1_string:add_reseed_str TEST_ASSERT( ctr_drbg_reseed( &ctx, add_reseed, add_reseed_len ) == 0 ); TEST_ASSERT( ctr_drbg_random_with_add( &ctx, buf, 16, add2, add2_len ) == 0 ); hexify( output_str, buf, 16 ); - TEST_ASSERT( strcmp( (char *) output_str, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( (char *) output_str, result_str ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_debug.function b/tests/suites/test_suite_debug.function index 05cc63093..a355eabf2 100644 --- a/tests/suites/test_suite_debug.function +++ b/tests/suites/test_suite_debug.function @@ -1,4 +1,4 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include struct buffer_data @@ -15,14 +15,16 @@ void string_debug(void *data, int level, const char *str) memcpy(buffer->ptr, str, strlen(str)); buffer->ptr += strlen(str); } -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_DEBUG_C:POLARSSL_BIGNUM_C:POLARSSL_SSL_TLS_C:POLARSSL_RSA_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_DEBUG_C:POLARSSL_BIGNUM_C:POLARSSL_SSL_TLS_C:POLARSSL_RSA_C + * END_DEPENDENCIES + */ -BEGIN_CASE -debug_print_crt:crt_file:file:line:prefix:result_str +/* BEGIN_CASE */ +void debug_print_crt( char *crt_file, char *file, int line, char *prefix, + char *result_str ) { x509_cert crt; ssl_context ssl; @@ -35,17 +37,18 @@ debug_print_crt:crt_file:file:line:prefix:result_str ssl_set_dbg(&ssl, string_debug, &buffer); - TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); - debug_print_crt( &ssl, 0, {file}, {line}, {prefix}, &crt); + TEST_ASSERT( x509parse_crtfile( &crt, crt_file ) == 0 ); + debug_print_crt( &ssl, 0, file, line, prefix, &crt); - TEST_ASSERT( strcmp( buffer.buf, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 ); x509_free( &crt ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -debug_print_mpi:radix:value:file:line:prefix:result_str +/* BEGIN_CASE */ +void debug_print_mpi( int radix, char *value, char *file, int line, + char *prefix, char *result_str ) { ssl_context ssl; struct buffer_data buffer; @@ -57,15 +60,13 @@ debug_print_mpi:radix:value:file:line:prefix:result_str memset( buffer.buf, 0, 2000 ); buffer.ptr = buffer.buf; - TEST_ASSERT( mpi_read_string( &val, {radix}, {value} ) == 0 ); + TEST_ASSERT( mpi_read_string( &val, radix, value ) == 0 ); ssl_set_dbg(&ssl, string_debug, &buffer); - debug_print_mpi( &ssl, 0, {file}, {line}, {prefix}, &val); + debug_print_mpi( &ssl, 0, file, line, prefix, &val); - TEST_ASSERT( strcmp( buffer.buf, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 ); mpi_free( &val ); } -END_CASE - - +/* END_CASE */ diff --git a/tests/suites/test_suite_des.function b/tests/suites/test_suite_des.function index be238d48d..865a46787 100644 --- a/tests/suites/test_suite_des.function +++ b/tests/suites/test_suite_des.function @@ -1,13 +1,15 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_DES_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_DES_C + * END_DEPENDENCIES + */ -BEGIN_CASE -des_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void des_encrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -20,19 +22,20 @@ des_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); des_setkey_enc( &ctx, key_str ); TEST_ASSERT( des_crypt_ecb( &ctx, src_str, output ) == 0 ); hexify( dst_str, output, 8 ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -des_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void des_decrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -45,19 +48,20 @@ des_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); des_setkey_dec( &ctx, key_str ); TEST_ASSERT( des_crypt_ecb( &ctx, src_str, output ) == 0 ); hexify( dst_str, output, 8 ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -des_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void des_encrypt_cbc( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string, int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -73,23 +77,24 @@ des_encrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_r memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + src_len = unhexify( src_str, hex_src_string ); des_setkey_enc( &ctx, key_str ); - TEST_ASSERT( des_crypt_cbc( &ctx, DES_ENCRYPT, src_len, iv_str, src_str, output ) == {cbc_result} ); - if( {cbc_result} == 0 ) + TEST_ASSERT( des_crypt_cbc( &ctx, DES_ENCRYPT, src_len, iv_str, src_str, output ) == cbc_result ); + if( cbc_result == 0 ) { hexify( dst_str, output, src_len ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -des_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void des_decrypt_cbc( char *hex_key_string, char *hex_iv_string, + char *hex_src_string, char *hex_dst_string, int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -105,23 +110,24 @@ des_decrypt_cbc:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_r memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + src_len = unhexify( src_str, hex_src_string ); des_setkey_dec( &ctx, key_str ); - TEST_ASSERT( des_crypt_cbc( &ctx, DES_DECRYPT, src_len, iv_str, src_str, output ) == {cbc_result} ); - if( {cbc_result} == 0 ) + TEST_ASSERT( des_crypt_cbc( &ctx, DES_DECRYPT, src_len, iv_str, src_str, output ) == cbc_result ); + if( cbc_result == 0 ) { hexify( dst_str, output, src_len ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -des3_encrypt_ecb:key_count:hex_key_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void des3_encrypt_ecb( int key_count, char *hex_key_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -134,12 +140,12 @@ des3_encrypt_ecb:key_count:hex_key_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); - if( {key_count} == 2 ) + if( key_count == 2 ) des3_set2key_enc( &ctx, key_str ); - else if( {key_count} == 3 ) + else if( key_count == 3 ) des3_set3key_enc( &ctx, key_str ); else TEST_ASSERT( 0 ); @@ -147,12 +153,13 @@ des3_encrypt_ecb:key_count:hex_key_string:hex_src_string:hex_dst_string TEST_ASSERT( des3_crypt_ecb( &ctx, src_str, output ) == 0 ); hexify( dst_str, output, 8 ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -des3_decrypt_ecb:key_count:hex_key_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void des3_decrypt_ecb( int key_count, char *hex_key_string, + char *hex_src_string, char *hex_dst_string ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -165,12 +172,12 @@ des3_decrypt_ecb:key_count:hex_key_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); - if( {key_count} == 2 ) + if( key_count == 2 ) des3_set2key_dec( &ctx, key_str ); - else if( {key_count} == 3 ) + else if( key_count == 3 ) des3_set3key_dec( &ctx, key_str ); else TEST_ASSERT( 0 ); @@ -178,12 +185,14 @@ des3_decrypt_ecb:key_count:hex_key_string:hex_src_string:hex_dst_string TEST_ASSERT( des3_crypt_ecb( &ctx, src_str, output ) == 0 ); hexify( dst_str, output, 8 ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -des3_encrypt_cbc:key_count:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void des3_encrypt_cbc( int key_count, char *hex_key_string, + char *hex_iv_string, char *hex_src_string, + char *hex_dst_string, int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -199,30 +208,32 @@ des3_encrypt_cbc:key_count:hex_key_string:hex_iv_string:hex_src_string:hex_dst_s memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + src_len = unhexify( src_str, hex_src_string ); - if( {key_count} == 2 ) + if( key_count == 2 ) des3_set2key_enc( &ctx, key_str ); - else if( {key_count} == 3 ) + else if( key_count == 3 ) des3_set3key_enc( &ctx, key_str ); else TEST_ASSERT( 0 ); - TEST_ASSERT( des3_crypt_cbc( &ctx, DES_ENCRYPT, src_len, iv_str, src_str, output ) == {cbc_result} ); + TEST_ASSERT( des3_crypt_cbc( &ctx, DES_ENCRYPT, src_len, iv_str, src_str, output ) == cbc_result ); - if( {cbc_result} == 0 ) + if( cbc_result == 0 ) { hexify( dst_str, output, src_len ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -des3_decrypt_cbc:key_count:hex_key_string:hex_iv_string:hex_src_string:hex_dst_string:cbc_result +/* BEGIN_CASE */ +void des3_decrypt_cbc( int key_count, char *hex_key_string, + char *hex_iv_string, char *hex_src_string, + char *hex_dst_string, int cbc_result ) { unsigned char key_str[100]; unsigned char iv_str[100]; @@ -238,30 +249,30 @@ des3_decrypt_cbc:key_count:hex_key_string:hex_iv_string:hex_src_string:hex_dst_s memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( iv_str, {hex_iv_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( iv_str, hex_iv_string ); + src_len = unhexify( src_str, hex_src_string ); - if( {key_count} == 2 ) + if( key_count == 2 ) des3_set2key_dec( &ctx, key_str ); - else if( {key_count} == 3 ) + else if( key_count == 3 ) des3_set3key_dec( &ctx, key_str ); else TEST_ASSERT( 0 ); - TEST_ASSERT( des3_crypt_cbc( &ctx, DES_DECRYPT, src_len, iv_str, src_str, output ) == {cbc_result} ); + TEST_ASSERT( des3_crypt_cbc( &ctx, DES_DECRYPT, src_len, iv_str, src_str, output ) == cbc_result ); - if( {cbc_result} == 0 ) + if( cbc_result == 0 ) { hexify( dst_str, output, src_len ); - TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -des_key_parity_run: +/* BEGIN_CASE */ +void des_key_parity_run() { int i, j, cnt; unsigned char key[DES_KEY_SIZE]; @@ -301,11 +312,11 @@ des_key_parity_run: TEST_ASSERT( des_key_check_key_parity( key ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -des_selftest: +/* BEGIN_CASE */ +void des_selftest() { TEST_ASSERT( des_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_dhm.function b/tests/suites/test_suite_dhm.function index 6573100da..e6524cc14 100644 --- a/tests/suites/test_suite_dhm.function +++ b/tests/suites/test_suite_dhm.function @@ -1,13 +1,15 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_DHM_C:POLARSSL_BIGNUM_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_DHM_C:POLARSSL_BIGNUM_C + * END_DEPENDENCIES + */ -BEGIN_CASE -dhm_do_dhm:x_size:radix_P:input_P:radix_G:input_G +/* BEGIN_CASE */ +void dhm_do_dhm( int NOTUSED, int radix_P, char *input_P, + int radix_G, char *input_G ) { dhm_context ctx_srv; dhm_context ctx_cli; @@ -23,6 +25,8 @@ dhm_do_dhm:x_size:radix_P:input_P:radix_G:input_G int x_size; rnd_pseudo_info rnd_info; + ((void)NOTUSED); + memset( &ctx_srv, 0x00, sizeof( dhm_context ) ); memset( &ctx_cli, 0x00, sizeof( dhm_context ) ); memset( ske, 0x00, 1000 ); @@ -31,8 +35,8 @@ dhm_do_dhm:x_size:radix_P:input_P:radix_G:input_G memset( sec_cli, 0x00, 1000 ); memset( &rnd_info, 0x00, sizeof( rnd_pseudo_info ) ); - TEST_ASSERT( mpi_read_string( &ctx_srv.P, {radix_P}, {input_P} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx_srv.G, {radix_G}, {input_G} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx_srv.P, radix_P, input_P ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx_srv.G, radix_G, input_G ) == 0 ); x_size = mpi_size( &ctx_srv.P ); TEST_ASSERT( dhm_make_params( &ctx_srv, x_size, ske, &ske_len, &rnd_pseudo_rand, &rnd_info ) == 0 ); @@ -55,4 +59,4 @@ dhm_do_dhm:x_size:radix_P:input_P:radix_G:input_G dhm_free( &ctx_srv ); dhm_free( &ctx_cli ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_ecdh.data b/tests/suites/test_suite_ecdh.data index 47b68fb59..31b440a21 100644 --- a/tests/suites/test_suite_ecdh.data +++ b/tests/suites/test_suite_ecdh.data @@ -1,29 +1,29 @@ ECDH primitive random #1 -ecdh_primitive_random:SECP192R1 +ecdh_primitive_random:POLARSSL_ECP_DP_SECP192R1 ECDH primitive random #2 -ecdh_primitive_random:SECP224R1 +ecdh_primitive_random:POLARSSL_ECP_DP_SECP224R1 ECDH primitive random #3 -ecdh_primitive_random:SECP256R1 +ecdh_primitive_random:POLARSSL_ECP_DP_SECP256R1 ECDH primitive random #4 -ecdh_primitive_random:SECP384R1 +ecdh_primitive_random:POLARSSL_ECP_DP_SECP384R1 ECDH primitive random #5 -ecdh_primitive_random:SECP521R1 +ecdh_primitive_random:POLARSSL_ECP_DP_SECP521R1 ECDH primitive rfc 5903 p256 -ecdh_primitive_testvec:SECP256R1:C88F01F510D9AC3F70A292DAA2316DE544E9AAB8AFE84049C62A9C57862D1433:DAD0B65394221CF9B051E1FECA5787D098DFE637FC90B9EF945D0C3772581180:5271A0461CDB8252D61F1C456FA3E59AB1F45B33ACCF5F58389E0577B8990BB3:C6EF9C5D78AE012A011164ACB397CE2088685D8F06BF9BE0B283AB46476BEE53:D12DFB5289C8D4F81208B70270398C342296970A0BCCB74C736FC7554494BF63:56FBF3CA366CC23E8157854C13C58D6AAC23F046ADA30F8353E74F33039872AB:D6840F6B42F6EDAFD13116E0E12565202FEF8E9ECE7DCE03812464D04B9442DE +ecdh_primitive_testvec:POLARSSL_ECP_DP_SECP256R1:"C88F01F510D9AC3F70A292DAA2316DE544E9AAB8AFE84049C62A9C57862D1433":"DAD0B65394221CF9B051E1FECA5787D098DFE637FC90B9EF945D0C3772581180":"5271A0461CDB8252D61F1C456FA3E59AB1F45B33ACCF5F58389E0577B8990BB3":"C6EF9C5D78AE012A011164ACB397CE2088685D8F06BF9BE0B283AB46476BEE53":"D12DFB5289C8D4F81208B70270398C342296970A0BCCB74C736FC7554494BF63":"56FBF3CA366CC23E8157854C13C58D6AAC23F046ADA30F8353E74F33039872AB":"D6840F6B42F6EDAFD13116E0E12565202FEF8E9ECE7DCE03812464D04B9442DE" ECDH primitive rfc 5903 p384 -ecdh_primitive_testvec:SECP384R1:099F3C7034D4A2C699884D73A375A67F7624EF7C6B3C0F160647B67414DCE655E35B538041E649EE3FAEF896783AB194:667842D7D180AC2CDE6F74F37551F55755C7645C20EF73E31634FE72B4C55EE6DE3AC808ACB4BDB4C88732AEE95F41AA:9482ED1FC0EEB9CAFC4984625CCFC23F65032149E0E144ADA024181535A0F38EEB9FCFF3C2C947DAE69B4C634573A81C:41CB0779B4BDB85D47846725FBEC3C9430FAB46CC8DC5060855CC9BDA0AA2942E0308312916B8ED2960E4BD55A7448FC:E558DBEF53EECDE3D3FCCFC1AEA08A89A987475D12FD950D83CFA41732BC509D0D1AC43A0336DEF96FDA41D0774A3571:DCFBEC7AACF3196472169E838430367F66EEBE3C6E70C416DD5F0C68759DD1FFF83FA40142209DFF5EAAD96DB9E6386C:11187331C279962D93D604243FD592CB9D0A926F422E47187521287E7156C5C4D603135569B9E9D09CF5D4A270F59746 +ecdh_primitive_testvec:POLARSSL_ECP_DP_SECP384R1:"099F3C7034D4A2C699884D73A375A67F7624EF7C6B3C0F160647B67414DCE655E35B538041E649EE3FAEF896783AB194":"667842D7D180AC2CDE6F74F37551F55755C7645C20EF73E31634FE72B4C55EE6DE3AC808ACB4BDB4C88732AEE95F41AA":"9482ED1FC0EEB9CAFC4984625CCFC23F65032149E0E144ADA024181535A0F38EEB9FCFF3C2C947DAE69B4C634573A81C":"41CB0779B4BDB85D47846725FBEC3C9430FAB46CC8DC5060855CC9BDA0AA2942E0308312916B8ED2960E4BD55A7448FC":"E558DBEF53EECDE3D3FCCFC1AEA08A89A987475D12FD950D83CFA41732BC509D0D1AC43A0336DEF96FDA41D0774A3571":"DCFBEC7AACF3196472169E838430367F66EEBE3C6E70C416DD5F0C68759DD1FFF83FA40142209DFF5EAAD96DB9E6386C":"11187331C279962D93D604243FD592CB9D0A926F422E47187521287E7156C5C4D603135569B9E9D09CF5D4A270F59746" ECDH primitive rfc 5903 p521 -ecdh_primitive_testvec:SECP521R1:0037ADE9319A89F4DABDB3EF411AACCCA5123C61ACAB57B5393DCE47608172A095AA85A30FE1C2952C6771D937BA9777F5957B2639BAB072462F68C27A57382D4A52:0015417E84DBF28C0AD3C278713349DC7DF153C897A1891BD98BAB4357C9ECBEE1E3BF42E00B8E380AEAE57C2D107564941885942AF5A7F4601723C4195D176CED3E:017CAE20B6641D2EEB695786D8C946146239D099E18E1D5A514C739D7CB4A10AD8A788015AC405D7799DC75E7B7D5B6CF2261A6A7F1507438BF01BEB6CA3926F9582:0145BA99A847AF43793FDD0E872E7CDFA16BE30FDC780F97BCCC3F078380201E9C677D600B343757A3BDBF2A3163E4C2F869CCA7458AA4A4EFFC311F5CB151685EB9:00D0B3975AC4B799F5BEA16D5E13E9AF971D5E9B984C9F39728B5E5739735A219B97C356436ADC6E95BB0352F6BE64A6C2912D4EF2D0433CED2B6171640012D9460F:015C68226383956E3BD066E797B623C27CE0EAC2F551A10C2C724D9852077B87220B6536C5C408A1D2AEBB8E86D678AE49CB57091F4732296579AB44FCD17F0FC56A:01144C7D79AE6956BC8EDB8E7C787C4521CB086FA64407F97894E5E6B2D79B04D1427E73CA4BAA240A34786859810C06B3C715A3A8CC3151F2BEE417996D19F3DDEA +ecdh_primitive_testvec:POLARSSL_ECP_DP_SECP521R1:"0037ADE9319A89F4DABDB3EF411AACCCA5123C61ACAB57B5393DCE47608172A095AA85A30FE1C2952C6771D937BA9777F5957B2639BAB072462F68C27A57382D4A52":"0015417E84DBF28C0AD3C278713349DC7DF153C897A1891BD98BAB4357C9ECBEE1E3BF42E00B8E380AEAE57C2D107564941885942AF5A7F4601723C4195D176CED3E":"017CAE20B6641D2EEB695786D8C946146239D099E18E1D5A514C739D7CB4A10AD8A788015AC405D7799DC75E7B7D5B6CF2261A6A7F1507438BF01BEB6CA3926F9582":"0145BA99A847AF43793FDD0E872E7CDFA16BE30FDC780F97BCCC3F078380201E9C677D600B343757A3BDBF2A3163E4C2F869CCA7458AA4A4EFFC311F5CB151685EB9":"00D0B3975AC4B799F5BEA16D5E13E9AF971D5E9B984C9F39728B5E5739735A219B97C356436ADC6E95BB0352F6BE64A6C2912D4EF2D0433CED2B6171640012D9460F":"015C68226383956E3BD066E797B623C27CE0EAC2F551A10C2C724D9852077B87220B6536C5C408A1D2AEBB8E86D678AE49CB57091F4732296579AB44FCD17F0FC56A":"01144C7D79AE6956BC8EDB8E7C787C4521CB086FA64407F97894E5E6B2D79B04D1427E73CA4BAA240A34786859810C06B3C715A3A8CC3151F2BEE417996D19F3DDEA" ECDH exchange #1 -ecdh_exchange:SECP192R1 +ecdh_exchange:POLARSSL_ECP_DP_SECP192R1 ECDH exchange #2 -ecdh_exchange:SECP521R1 +ecdh_exchange:POLARSSL_ECP_DP_SECP521R1 diff --git a/tests/suites/test_suite_ecdh.function b/tests/suites/test_suite_ecdh.function index 105f99ce0..6acf4df3b 100644 --- a/tests/suites/test_suite_ecdh.function +++ b/tests/suites/test_suite_ecdh.function @@ -1,13 +1,14 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_ECDH_C:POLARSSL_ECP_C:POLARSSL_BIGNUM_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_ECDH_C:POLARSSL_ECP_C:POLARSSL_BIGNUM_C + * END_DEPENDENCIES + */ -BEGIN_CASE -ecdh_primitive_random:id +/* BEGIN_CASE */ +void ecdh_primitive_random( int id ) { ecp_group grp; ecp_point qA, qB; @@ -20,7 +21,7 @@ ecdh_primitive_random:id mpi_init( &zA ); mpi_init( &zB ); memset( &rnd_info, 0x00, sizeof( rnd_pseudo_info ) ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); TEST_ASSERT( ecdh_gen_public( &grp, &dA, &qA, &rnd_pseudo_rand, &rnd_info ) == 0 ); @@ -36,10 +37,12 @@ ecdh_primitive_random:id mpi_free( &dA ); mpi_free( &dB ); mpi_free( &zA ); mpi_free( &zB ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecdh_primitive_testvec:id:dA:xA:yA:dB:xB:yB:z +/* BEGIN_CASE */ +void ecdh_primitive_testvec( int id, char *dA_str, char *xA_str, char *yA_str, + char *dB_str, char *xB_str, char *yB_str, + char *z_str ) { ecp_group grp; ecp_point qA, qB; @@ -50,23 +53,23 @@ ecdh_primitive_testvec:id:dA:xA:yA:dB:xB:yB:z mpi_init( &dA ); mpi_init( &dB ); mpi_init( &zA ); mpi_init( &zB ); mpi_init( &check ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); - TEST_ASSERT( ecdh_gen_public( &grp, &dA, &qA, ¬_rnd, "{dA}" ) == 0 ); + TEST_ASSERT( ecdh_gen_public( &grp, &dA, &qA, ¬_rnd, dA_str ) == 0 ); TEST_ASSERT( ! ecp_is_zero( &qA ) ); - TEST_ASSERT( mpi_read_string( &check, 16, "{xA}" ) == 0 ); + TEST_ASSERT( mpi_read_string( &check, 16, xA_str ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &qA.X, &check ) == 0 ); - TEST_ASSERT( mpi_read_string( &check, 16, "{yA}" ) == 0 ); + TEST_ASSERT( mpi_read_string( &check, 16, yA_str ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &qA.Y, &check ) == 0 ); - TEST_ASSERT( ecdh_gen_public( &grp, &dB, &qB, ¬_rnd, "{dB}" ) == 0 ); + TEST_ASSERT( ecdh_gen_public( &grp, &dB, &qB, ¬_rnd, dB_str ) == 0 ); TEST_ASSERT( ! ecp_is_zero( &qB ) ); - TEST_ASSERT( mpi_read_string( &check, 16, "{xB}" ) == 0 ); + TEST_ASSERT( mpi_read_string( &check, 16, xB_str ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &qB.X, &check ) == 0 ); - TEST_ASSERT( mpi_read_string( &check, 16, "{yB}" ) == 0 ); + TEST_ASSERT( mpi_read_string( &check, 16, yB_str ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &qB.Y, &check ) == 0 ); - TEST_ASSERT( mpi_read_string( &check, 16, "{z}" ) == 0 ); + TEST_ASSERT( mpi_read_string( &check, 16, z_str ) == 0 ); TEST_ASSERT( ecdh_compute_shared( &grp, &zA, &qB, &dA ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &zA, &check ) == 0 ); TEST_ASSERT( ecdh_compute_shared( &grp, &zB, &qA, &dB ) == 0 ); @@ -77,10 +80,10 @@ ecdh_primitive_testvec:id:dA:xA:yA:dB:xB:yB:z mpi_free( &dA ); mpi_free( &dB ); mpi_free( &zA ); mpi_free( &zB ); mpi_free( &check ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecdh_exchange:id +/* BEGIN_CASE */ +void ecdh_exchange( int id ) { ecdh_context srv, cli; unsigned char buf[1000]; @@ -92,7 +95,7 @@ ecdh_exchange:id ecdh_init( &cli ); memset( &rnd_info, 0x00, sizeof( rnd_pseudo_info ) ); - TEST_ASSERT( ecp_use_known_dp( &srv.grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &srv.grp, id ) == 0 ); memset( buf, 0x00, sizeof( buf ) ); vbuf = buf; TEST_ASSERT( ecdh_make_params( &srv, &len, buf, 1000, @@ -111,4 +114,4 @@ ecdh_exchange:id ecdh_free( &srv ); ecdh_free( &cli ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_ecdsa.data b/tests/suites/test_suite_ecdsa.data index 5a94419f7..386c8f43e 100644 --- a/tests/suites/test_suite_ecdsa.data +++ b/tests/suites/test_suite_ecdsa.data @@ -1,24 +1,24 @@ ECDSA primitive random #1 -ecdsa_prim_random:SECP192R1 +ecdsa_prim_random:POLARSSL_ECP_DP_SECP192R1 ECDSA primitive random #2 -ecdsa_prim_random:SECP224R1 +ecdsa_prim_random:POLARSSL_ECP_DP_SECP224R1 ECDSA primitive random #3 -ecdsa_prim_random:SECP256R1 +ecdsa_prim_random:POLARSSL_ECP_DP_SECP256R1 ECDSA primitive random #4 -ecdsa_prim_random:SECP384R1 +ecdsa_prim_random:POLARSSL_ECP_DP_SECP384R1 ECDSA primitive random #5 -ecdsa_prim_random:SECP521R1 +ecdsa_prim_random:POLARSSL_ECP_DP_SECP521R1 ECDSA primitive rfc 4754 p256 -ecdsa_prim_test_vectors:SECP256R1:DC51D3866A15BACDE33D96F992FCA99DA7E6EF0934E7097559C27F1614C88A7F:2442A5CC0ECD015FA3CA31DC8E2BBC70BF42D60CBCA20085E0822CB04235E970:6FC98BD7E50211A4A27102FA3549DF79EBCB4BF246B80945CDDFE7D509BBFD7D:9E56F509196784D963D1C0A401510EE7ADA3DCC5DEE04B154BF61AF1D5A6DECE:BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD:CB28E0999B9C7715FD0A80D8E47A77079716CBBF917DD72E97566EA1C066957C:86FA3BB4E26CAD5BF90B7F81899256CE7594BB1EA0C89212748BFF3B3D5B0315 +ecdsa_prim_test_vectors:POLARSSL_ECP_DP_SECP256R1:"DC51D3866A15BACDE33D96F992FCA99DA7E6EF0934E7097559C27F1614C88A7F":"2442A5CC0ECD015FA3CA31DC8E2BBC70BF42D60CBCA20085E0822CB04235E970":"6FC98BD7E50211A4A27102FA3549DF79EBCB4BF246B80945CDDFE7D509BBFD7D":"9E56F509196784D963D1C0A401510EE7ADA3DCC5DEE04B154BF61AF1D5A6DECE":"BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD":"CB28E0999B9C7715FD0A80D8E47A77079716CBBF917DD72E97566EA1C066957C":"86FA3BB4E26CAD5BF90B7F81899256CE7594BB1EA0C89212748BFF3B3D5B0315" ECDSA primitive rfc 4754 p384 -ecdsa_prim_test_vectors:SECP384R1:0BEB646634BA87735D77AE4809A0EBEA865535DE4C1E1DCB692E84708E81A5AF62E528C38B2A81B35309668D73524D9F:96281BF8DD5E0525CA049C048D345D3082968D10FEDF5C5ACA0C64E6465A97EA5CE10C9DFEC21797415710721F437922:447688BA94708EB6E2E4D59F6AB6D7EDFF9301D249FE49C33096655F5D502FAD3D383B91C5E7EDAA2B714CC99D5743CA:B4B74E44D71A13D568003D7489908D564C7761E229C58CBFA18950096EB7463B854D7FA992F934D927376285E63414FA:CB00753F45A35E8BB5A03D699AC65007272C32AB0EDED1631A8B605A43FF5BED8086072BA1E7CC2358BAECA134C825A7:FB017B914E29149432D8BAC29A514640B46F53DDAB2C69948084E2930F1C8F7E08E07C9C63F2D21A07DCB56A6AF56EB3:B263A1305E057F984D38726A1B46874109F417BCA112674C528262A40A629AF1CBB9F516CE0FA7D2FF630863A00E8B9F +ecdsa_prim_test_vectors:POLARSSL_ECP_DP_SECP384R1:"0BEB646634BA87735D77AE4809A0EBEA865535DE4C1E1DCB692E84708E81A5AF62E528C38B2A81B35309668D73524D9F":"96281BF8DD5E0525CA049C048D345D3082968D10FEDF5C5ACA0C64E6465A97EA5CE10C9DFEC21797415710721F437922":"447688BA94708EB6E2E4D59F6AB6D7EDFF9301D249FE49C33096655F5D502FAD3D383B91C5E7EDAA2B714CC99D5743CA":"B4B74E44D71A13D568003D7489908D564C7761E229C58CBFA18950096EB7463B854D7FA992F934D927376285E63414FA":"CB00753F45A35E8BB5A03D699AC65007272C32AB0EDED1631A8B605A43FF5BED8086072BA1E7CC2358BAECA134C825A7":"FB017B914E29149432D8BAC29A514640B46F53DDAB2C69948084E2930F1C8F7E08E07C9C63F2D21A07DCB56A6AF56EB3":"B263A1305E057F984D38726A1B46874109F417BCA112674C528262A40A629AF1CBB9F516CE0FA7D2FF630863A00E8B9F" ECDSA primitive rfc 4754 p521 -ecdsa_prim_test_vectors:SECP521R1:0065FDA3409451DCAB0A0EAD45495112A3D813C17BFD34BDF8C1209D7DF5849120597779060A7FF9D704ADF78B570FFAD6F062E95C7E0C5D5481C5B153B48B375FA1:0151518F1AF0F563517EDD5485190DF95A4BF57B5CBA4CF2A9A3F6474725A35F7AFE0A6DDEB8BEDBCD6A197E592D40188901CECD650699C9B5E456AEA5ADD19052A8:006F3B142EA1BFFF7E2837AD44C9E4FF6D2D34C73184BBAD90026DD5E6E85317D9DF45CAD7803C6C20035B2F3FF63AFF4E1BA64D1C077577DA3F4286C58F0AEAE643:00C1C2B305419F5A41344D7E4359933D734096F556197A9B244342B8B62F46F9373778F9DE6B6497B1EF825FF24F42F9B4A4BD7382CFC3378A540B1B7F0C1B956C2F:DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA20A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD454D4423643CE80E2A9AC94FA54CA49F:0154FD3836AF92D0DCA57DD5341D3053988534FDE8318FC6AAAAB68E2E6F4339B19F2F281A7E0B22C269D93CF8794A9278880ED7DBB8D9362CAEACEE544320552251:017705A7030290D1CEB605A9A1BB03FF9CDD521E87A696EC926C8C10C8362DF4975367101F67D1CF9BCCBF2F3D239534FA509E70AAC851AE01AAC68D62F866472660 +ecdsa_prim_test_vectors:POLARSSL_ECP_DP_SECP521R1:"0065FDA3409451DCAB0A0EAD45495112A3D813C17BFD34BDF8C1209D7DF5849120597779060A7FF9D704ADF78B570FFAD6F062E95C7E0C5D5481C5B153B48B375FA1":"0151518F1AF0F563517EDD5485190DF95A4BF57B5CBA4CF2A9A3F6474725A35F7AFE0A6DDEB8BEDBCD6A197E592D40188901CECD650699C9B5E456AEA5ADD19052A8":"006F3B142EA1BFFF7E2837AD44C9E4FF6D2D34C73184BBAD90026DD5E6E85317D9DF45CAD7803C6C20035B2F3FF63AFF4E1BA64D1C077577DA3F4286C58F0AEAE643":"00C1C2B305419F5A41344D7E4359933D734096F556197A9B244342B8B62F46F9373778F9DE6B6497B1EF825FF24F42F9B4A4BD7382CFC3378A540B1B7F0C1B956C2F":"DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA20A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD454D4423643CE80E2A9AC94FA54CA49F":"0154FD3836AF92D0DCA57DD5341D3053988534FDE8318FC6AAAAB68E2E6F4339B19F2F281A7E0B22C269D93CF8794A9278880ED7DBB8D9362CAEACEE544320552251":"017705A7030290D1CEB605A9A1BB03FF9CDD521E87A696EC926C8C10C8362DF4975367101F67D1CF9BCCBF2F3D239534FA509E70AAC851AE01AAC68D62F866472660" diff --git a/tests/suites/test_suite_ecdsa.function b/tests/suites/test_suite_ecdsa.function index e7d4900dd..5e1ba6431 100644 --- a/tests/suites/test_suite_ecdsa.function +++ b/tests/suites/test_suite_ecdsa.function @@ -1,13 +1,14 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_ECDSA_C:POLARSSL_ECP_C:POLARSSL_BIGNUM_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_ECDSA_C:POLARSSL_ECP_C:POLARSSL_BIGNUM_C + * END_DEPENDENCIES + */ -BEGIN_CASE -ecdsa_prim_random:id +/* BEGIN_CASE */ +void ecdsa_prim_random( int id ) { ecp_group grp; ecp_point Q; @@ -23,7 +24,7 @@ ecdsa_prim_random:id /* prepare material for signature */ TEST_ASSERT( rnd_pseudo_rand( &rnd_info, buf, sizeof( buf ) ) == 0 ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); TEST_ASSERT( ecp_gen_keypair( &grp, &d, &Q, &rnd_pseudo_rand, &rnd_info ) == 0 ); @@ -35,10 +36,12 @@ ecdsa_prim_random:id ecp_point_free( &Q ); mpi_free( &d ); mpi_free( &r ); mpi_free( &s ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecdsa_prim_test_vectors:id:d:xQ:yQ:k:hash:r:s +/* BEGIN_CASE */ +void ecdsa_prim_test_vectors( int id, char *d_str, char *xQ_str, char *yQ_str, + char *k_str, char *hash_str, char *r_str, + char *s_str ) { ecp_group grp; ecp_point Q; @@ -52,15 +55,15 @@ ecdsa_prim_test_vectors:id:d:xQ:yQ:k:hash:r:s mpi_init( &r_check ); mpi_init( &s_check ); memset( buf, 0, sizeof( buf ) ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); - TEST_ASSERT( ecp_point_read_string( &Q, 16, "{xQ}", "{yQ}" ) == 0 ); - TEST_ASSERT( mpi_read_string( &d, 16, "{d}" ) == 0 ); - TEST_ASSERT( mpi_read_string( &r_check, 16, "{r}" ) == 0 ); - TEST_ASSERT( mpi_read_string( &s_check, 16, "{s}" ) == 0 ); - len = unhexify(buf, "{hash}"); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); + TEST_ASSERT( ecp_point_read_string( &Q, 16, xQ_str, yQ_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &d, 16, d_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &r_check, 16, r_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &s_check, 16, s_str ) == 0 ); + len = unhexify(buf, hash_str); TEST_ASSERT( ecdsa_sign( &grp, &r, &s, &d, buf, len, - ¬_rnd, "{k}" ) == 0 ); + ¬_rnd, k_str ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &r, &r_check ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &s, &s_check ) == 0 ); @@ -72,4 +75,4 @@ ecdsa_prim_test_vectors:id:d:xQ:yQ:k:hash:r:s mpi_free( &d ); mpi_free( &r ); mpi_free( &s ); mpi_free( &r_check ); mpi_free( &s_check ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_ecp.data b/tests/suites/test_suite_ecp.data index 73acb4fb3..ce9263364 100644 --- a/tests/suites/test_suite_ecp.data +++ b/tests/suites/test_suite_ecp.data @@ -135,91 +135,91 @@ ecp_small_check_pub:10:25:1:POLARSSL_ERR_ECP_GENERIC ECP write binary #0 (zero, bad format) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"01":"01":"00":UNKNOWN:"00":1:POLARSSL_ERR_ECP_BAD_INPUT_DATA +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"01":"01":"00":POLARSSL_ECP_PF_UNKNOWN:"00":1:POLARSSL_ERR_ECP_BAD_INPUT_DATA ECP write binary #1 (zero, uncompressed, buffer just fits) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"01":"01":"00":UNCOMPRESSED:"00":1:0 +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"01":"01":"00":POLARSSL_ECP_PF_UNCOMPRESSED:"00":1:0 ECP write binary #2 (zero, buffer too small) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"01":"01":"00":UNCOMPRESSED:"00":0:POLARSSL_ERR_ECP_BUFFER_TOO_SMALL +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"01":"01":"00":POLARSSL_ECP_PF_UNCOMPRESSED:"00":0:POLARSSL_ERR_ECP_BUFFER_TOO_SMALL ECP write binary #3 (non-zero, uncompressed, buffer just fits) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":UNCOMPRESSED:"0448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":49:0 +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ECP_PF_UNCOMPRESSED:"0448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":49:0 ECP write binary #4 (non-zero, uncompressed, buffer too small) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":UNCOMPRESSED:"0448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":48:POLARSSL_ERR_ECP_BUFFER_TOO_SMALL +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ECP_PF_UNCOMPRESSED:"0448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":48:POLARSSL_ERR_ECP_BUFFER_TOO_SMALL ECP write binary #5 (zero, compressed, buffer just fits) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"01":"01":"00":COMPRESSED:"00":1:0 +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"01":"01":"00":POLARSSL_ECP_PF_COMPRESSED:"00":1:0 ECP write binary #6 (zero, buffer too small) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"01":"01":"00":COMPRESSED:"00":0:POLARSSL_ERR_ECP_BUFFER_TOO_SMALL +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"01":"01":"00":POLARSSL_ECP_PF_COMPRESSED:"00":0:POLARSSL_ERR_ECP_BUFFER_TOO_SMALL ECP write binary #7 (even, compressed, buffer just fits) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":COMPRESSED:"0248d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":25:0 +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ECP_PF_COMPRESSED:"0248d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":25:0 ECP write binary #8 (even, compressed, buffer too small) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":COMPRESSED:"0248d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":24:POLARSSL_ERR_ECP_BUFFER_TOO_SMALL +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ECP_PF_COMPRESSED:"0248d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":24:POLARSSL_ERR_ECP_BUFFER_TOO_SMALL ECP write binary #9 (odd, compressed, buffer just fits) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_write_binary:SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"93112b28345b7d1d7799611e49bea9d8290cb2d7afe1f9f3":"01":COMPRESSED:"0348d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":25:0 +ecp_write_binary:POLARSSL_ECP_DP_SECP192R1:"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"93112b28345b7d1d7799611e49bea9d8290cb2d7afe1f9f3":"01":POLARSSL_ECP_PF_COMPRESSED:"0348d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":25:0 ECP read binary #1 (zero, invalid ilen) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_read_binary:SECP192R1:"0000":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA +ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"0000":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA ECP read binary #2 (zero, invalid first byte) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_read_binary:SECP192R1:"01":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA +ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"01":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA ECP read binary #3 (zero, OK) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_read_binary:SECP192R1:"00":"01":"01":"00":0 +ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"00":"01":"01":"00":0 ECP read binary #4 (non-zero, invalid ilen) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_read_binary:SECP192R1:"04001122":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA +ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"04001122":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA ECP read binary #5 (non-zero, invalid first byte) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_read_binary:SECP192R1:"0548d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ERR_ECP_BAD_INPUT_DATA +ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"0548d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ERR_ECP_BAD_INPUT_DATA ECP read binary #6 (non-zero, OK) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_read_binary:SECP192R1:"0448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":0 +ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"0448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":0 ECP tls read point #1 (zero, invalid length byte) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_tls_read_point:SECP192R1:"0200":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA +ecp_tls_read_point:POLARSSL_ECP_DP_SECP192R1:"0200":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA ECP tls read point #2 (zero, OK) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_tls_read_point:SECP192R1:"0100":"01":"01":"00":0 +ecp_tls_read_point:POLARSSL_ECP_DP_SECP192R1:"0100":"01":"01":"00":0 ECP tls read point #3 (non-zero, invalid length byte) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_tls_read_point:SECP192R1:"300448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ERR_ECP_BAD_INPUT_DATA +ecp_tls_read_point:POLARSSL_ECP_DP_SECP192R1:"300448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ERR_ECP_BAD_INPUT_DATA ECP tls read point #4 (non-zero, OK) depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_tls_read_point:SECP192R1:"310448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":0 +ecp_tls_read_point:POLARSSL_ECP_DP_SECP192R1:"310448d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":0 ECP tls write-read point #1 depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_tls_write_read_point:SECP192R1 +ecp_tls_write_read_point:POLARSSL_ECP_DP_SECP192R1 ECP tls write-read point #2 depends_on:POLARSSL_ECP_DP_SECP521R1_ENABLED -ecp_tls_write_read_point:SECP521R1 +ecp_tls_write_read_point:POLARSSL_ECP_DP_SECP521R1 ECP tls read group #1 (record too short) ecp_tls_read_group:"0313":POLARSSL_ERR_ECP_BAD_INPUT_DATA:0 @@ -239,46 +239,46 @@ ecp_tls_read_group:"0300180000":0:384 ECP tls write-read group #1 depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_tls_write_read_group:SECP192R1 +ecp_tls_write_read_group:POLARSSL_ECP_DP_SECP192R1 ECP tls write-read group #2 depends_on:POLARSSL_ECP_DP_SECP521R1_ENABLED -ecp_tls_write_read_group:SECP521R1 +ecp_tls_write_read_group:POLARSSL_ECP_DP_SECP521R1 ECP check privkey -ecp_check_privkey:SECP192R1 +ecp_check_privkey:POLARSSL_ECP_DP_SECP192R1 ECP gen keypair depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_gen_keypair:SECP192R1 +ecp_gen_keypair:POLARSSL_ECP_DP_SECP192R1 ECP mod p192 readable depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_fast_mod:SECP192R1:"000000000000010500000000000001040000000000000103000000000000010200000000000001010000000000000100" +ecp_fast_mod:POLARSSL_ECP_DP_SECP192R1:"000000000000010500000000000001040000000000000103000000000000010200000000000001010000000000000100" ECP mod p192 random depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_fast_mod:SECP192R1:"36CF96B45D706A0954D89E52CE5F38517A2270E0175849B6F3740151D238CCABEF921437E475881D83BB69E4AA258EBD" +ecp_fast_mod:POLARSSL_ECP_DP_SECP192R1:"36CF96B45D706A0954D89E52CE5F38517A2270E0175849B6F3740151D238CCABEF921437E475881D83BB69E4AA258EBD" ECP test vectors secp192r1 rfc 5114 depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED -ecp_test_vect:SECP192R1:"323FA3169D8E9C6593F59476BC142000AB5BE0E249C43426":"CD46489ECFD6C105E7B3D32566E2B122E249ABAADD870612":"68887B4877DF51DD4DC3D6FD11F0A26F8FD3844317916E9A":"631F95BB4A67632C9C476EEE9AB695AB240A0499307FCF62":"519A121680E0045466BA21DF2EEE47F5973B500577EF13D5":"FF613AB4D64CEE3A20875BDB10F953F6B30CA072C60AA57F":"AD420182633F8526BFE954ACDA376F05E5FF4F837F54FEBE":"4371545ED772A59741D0EDA32C671112B7FDDD51461FCF32" +ecp_test_vect:POLARSSL_ECP_DP_SECP192R1:"323FA3169D8E9C6593F59476BC142000AB5BE0E249C43426":"CD46489ECFD6C105E7B3D32566E2B122E249ABAADD870612":"68887B4877DF51DD4DC3D6FD11F0A26F8FD3844317916E9A":"631F95BB4A67632C9C476EEE9AB695AB240A0499307FCF62":"519A121680E0045466BA21DF2EEE47F5973B500577EF13D5":"FF613AB4D64CEE3A20875BDB10F953F6B30CA072C60AA57F":"AD420182633F8526BFE954ACDA376F05E5FF4F837F54FEBE":"4371545ED772A59741D0EDA32C671112B7FDDD51461FCF32" ECP test vectors secp224r1 rfc 5114 depends_on:POLARSSL_ECP_DP_SECP224R1_ENABLED -ecp_test_vect:SECP224R1:"B558EB6C288DA707BBB4F8FBAE2AB9E9CB62E3BC5C7573E22E26D37F":"49DFEF309F81488C304CFF5AB3EE5A2154367DC7833150E0A51F3EEB":"4F2B5EE45762C4F654C1A0C67F54CF88B016B51BCE3D7C228D57ADB4":"AC3B1ADD3D9770E6F6A708EE9F3B8E0AB3B480E9F27F85C88B5E6D18":"6B3AC96A8D0CDE6A5599BE8032EDF10C162D0A8AD219506DCD42A207":"D491BE99C213A7D1CA3706DEBFE305F361AFCBB33E2609C8B1618AD5":"52272F50F46F4EDC9151569092F46DF2D96ECC3B6DC1714A4EA949FA":"5F30C6AA36DDC403C0ACB712BB88F1763C3046F6D919BD9C524322BF" +ecp_test_vect:POLARSSL_ECP_DP_SECP224R1:"B558EB6C288DA707BBB4F8FBAE2AB9E9CB62E3BC5C7573E22E26D37F":"49DFEF309F81488C304CFF5AB3EE5A2154367DC7833150E0A51F3EEB":"4F2B5EE45762C4F654C1A0C67F54CF88B016B51BCE3D7C228D57ADB4":"AC3B1ADD3D9770E6F6A708EE9F3B8E0AB3B480E9F27F85C88B5E6D18":"6B3AC96A8D0CDE6A5599BE8032EDF10C162D0A8AD219506DCD42A207":"D491BE99C213A7D1CA3706DEBFE305F361AFCBB33E2609C8B1618AD5":"52272F50F46F4EDC9151569092F46DF2D96ECC3B6DC1714A4EA949FA":"5F30C6AA36DDC403C0ACB712BB88F1763C3046F6D919BD9C524322BF" ECP test vectors secp256r1 rfc 5114 depends_on:POLARSSL_ECP_DP_SECP256R1_ENABLED -ecp_test_vect:SECP256R1:"814264145F2F56F2E96A8E337A1284993FAF432A5ABCE59E867B7291D507A3AF":"2AF502F3BE8952F2C9B5A8D4160D09E97165BE50BC42AE4A5E8D3B4BA83AEB15":"EB0FAF4CA986C4D38681A0F9872D79D56795BD4BFF6E6DE3C0F5015ECE5EFD85":"2CE1788EC197E096DB95A200CC0AB26A19CE6BCCAD562B8EEE1B593761CF7F41":"B120DE4AA36492795346E8DE6C2C8646AE06AAEA279FA775B3AB0715F6CE51B0":"9F1B7EECE20D7B5ED8EC685FA3F071D83727027092A8411385C34DDE5708B2B6":"DD0F5396219D1EA393310412D19A08F1F5811E9DC8EC8EEA7F80D21C820C2788":"0357DCCD4C804D0D8D33AA42B848834AA5605F9AB0D37239A115BBB647936F50" +ecp_test_vect:POLARSSL_ECP_DP_SECP256R1:"814264145F2F56F2E96A8E337A1284993FAF432A5ABCE59E867B7291D507A3AF":"2AF502F3BE8952F2C9B5A8D4160D09E97165BE50BC42AE4A5E8D3B4BA83AEB15":"EB0FAF4CA986C4D38681A0F9872D79D56795BD4BFF6E6DE3C0F5015ECE5EFD85":"2CE1788EC197E096DB95A200CC0AB26A19CE6BCCAD562B8EEE1B593761CF7F41":"B120DE4AA36492795346E8DE6C2C8646AE06AAEA279FA775B3AB0715F6CE51B0":"9F1B7EECE20D7B5ED8EC685FA3F071D83727027092A8411385C34DDE5708B2B6":"DD0F5396219D1EA393310412D19A08F1F5811E9DC8EC8EEA7F80D21C820C2788":"0357DCCD4C804D0D8D33AA42B848834AA5605F9AB0D37239A115BBB647936F50" ECP test vectors secp384r1 rfc 5114 depends_on:POLARSSL_ECP_DP_SECP384R1_ENABLED -ecp_test_vect:SECP384R1:"D27335EA71664AF244DD14E9FD1260715DFD8A7965571C48D709EE7A7962A156D706A90CBCB5DF2986F05FEADB9376F1":"793148F1787634D5DA4C6D9074417D05E057AB62F82054D10EE6B0403D6279547E6A8EA9D1FD77427D016FE27A8B8C66":"C6C41294331D23E6F480F4FB4CD40504C947392E94F4C3F06B8F398BB29E42368F7A685923DE3B67BACED214A1A1D128":"52D1791FDB4B70F89C0F00D456C2F7023B6125262C36A7DF1F80231121CCE3D39BE52E00C194A4132C4A6C768BCD94D2":"5CD42AB9C41B5347F74B8D4EFB708B3D5B36DB65915359B44ABC17647B6B9999789D72A84865AE2F223F12B5A1ABC120":"E171458FEAA939AAA3A8BFAC46B404BD8F6D5B348C0FA4D80CECA16356CA933240BDE8723415A8ECE035B0EDF36755DE":"5EA1FC4AF7256D2055981B110575E0A8CAE53160137D904C59D926EB1B8456E427AA8A4540884C37DE159A58028ABC0E":"0CC59E4B046414A81C8A3BDFDCA92526C48769DD8D3127CAA99B3632D1913942DE362EAFAA962379374D9F3F066841CA" +ecp_test_vect:POLARSSL_ECP_DP_SECP384R1:"D27335EA71664AF244DD14E9FD1260715DFD8A7965571C48D709EE7A7962A156D706A90CBCB5DF2986F05FEADB9376F1":"793148F1787634D5DA4C6D9074417D05E057AB62F82054D10EE6B0403D6279547E6A8EA9D1FD77427D016FE27A8B8C66":"C6C41294331D23E6F480F4FB4CD40504C947392E94F4C3F06B8F398BB29E42368F7A685923DE3B67BACED214A1A1D128":"52D1791FDB4B70F89C0F00D456C2F7023B6125262C36A7DF1F80231121CCE3D39BE52E00C194A4132C4A6C768BCD94D2":"5CD42AB9C41B5347F74B8D4EFB708B3D5B36DB65915359B44ABC17647B6B9999789D72A84865AE2F223F12B5A1ABC120":"E171458FEAA939AAA3A8BFAC46B404BD8F6D5B348C0FA4D80CECA16356CA933240BDE8723415A8ECE035B0EDF36755DE":"5EA1FC4AF7256D2055981B110575E0A8CAE53160137D904C59D926EB1B8456E427AA8A4540884C37DE159A58028ABC0E":"0CC59E4B046414A81C8A3BDFDCA92526C48769DD8D3127CAA99B3632D1913942DE362EAFAA962379374D9F3F066841CA" ECP test vectors secp521r1 rfc 5114 depends_on:POLARSSL_ECP_DP_SECP521R1_ENABLED -ecp_test_vect:SECP521R1:"0113F82DA825735E3D97276683B2B74277BAD27335EA71664AF2430CC4F33459B9669EE78B3FFB9B8683015D344DCBFEF6FB9AF4C6C470BE254516CD3C1A1FB47362":"01EBB34DD75721ABF8ADC9DBED17889CBB9765D90A7C60F2CEF007BB0F2B26E14881FD4442E689D61CB2DD046EE30E3FFD20F9A45BBDF6413D583A2DBF59924FD35C":"00F6B632D194C0388E22D8437E558C552AE195ADFD153F92D74908351B2F8C4EDA94EDB0916D1B53C020B5EECAED1A5FC38A233E4830587BB2EE3489B3B42A5A86A4":"00CEE3480D8645A17D249F2776D28BAE616952D1791FDB4B70F7C3378732AA1B22928448BCD1DC2496D435B01048066EBE4F72903C361B1A9DC1193DC2C9D0891B96":"010EBFAFC6E85E08D24BFFFCC1A4511DB0E634BEEB1B6DEC8C5939AE44766201AF6200430BA97C8AC6A0E9F08B33CE7E9FEEB5BA4EE5E0D81510C24295B8A08D0235":"00A4A6EC300DF9E257B0372B5E7ABFEF093436719A77887EBB0B18CF8099B9F4212B6E30A1419C18E029D36863CC9D448F4DBA4D2A0E60711BE572915FBD4FEF2695":"00CDEA89621CFA46B132F9E4CFE2261CDE2D4368EB5656634C7CC98C7A00CDE54ED1866A0DD3E6126C9D2F845DAFF82CEB1DA08F5D87521BB0EBECA77911169C20CC":"00F9A71641029B7FC1A808AD07CD4861E868614B865AFBECAB1F2BD4D8B55EBCB5E3A53143CEB2C511B1AE0AF5AC827F60F2FD872565AC5CA0A164038FE980A7E4BD" +ecp_test_vect:POLARSSL_ECP_DP_SECP521R1:"0113F82DA825735E3D97276683B2B74277BAD27335EA71664AF2430CC4F33459B9669EE78B3FFB9B8683015D344DCBFEF6FB9AF4C6C470BE254516CD3C1A1FB47362":"01EBB34DD75721ABF8ADC9DBED17889CBB9765D90A7C60F2CEF007BB0F2B26E14881FD4442E689D61CB2DD046EE30E3FFD20F9A45BBDF6413D583A2DBF59924FD35C":"00F6B632D194C0388E22D8437E558C552AE195ADFD153F92D74908351B2F8C4EDA94EDB0916D1B53C020B5EECAED1A5FC38A233E4830587BB2EE3489B3B42A5A86A4":"00CEE3480D8645A17D249F2776D28BAE616952D1791FDB4B70F7C3378732AA1B22928448BCD1DC2496D435B01048066EBE4F72903C361B1A9DC1193DC2C9D0891B96":"010EBFAFC6E85E08D24BFFFCC1A4511DB0E634BEEB1B6DEC8C5939AE44766201AF6200430BA97C8AC6A0E9F08B33CE7E9FEEB5BA4EE5E0D81510C24295B8A08D0235":"00A4A6EC300DF9E257B0372B5E7ABFEF093436719A77887EBB0B18CF8099B9F4212B6E30A1419C18E029D36863CC9D448F4DBA4D2A0E60711BE572915FBD4FEF2695":"00CDEA89621CFA46B132F9E4CFE2261CDE2D4368EB5656634C7CC98C7A00CDE54ED1866A0DD3E6126C9D2F845DAFF82CEB1DA08F5D87521BB0EBECA77911169C20CC":"00F9A71641029B7FC1A808AD07CD4861E868614B865AFBECAB1F2BD4D8B55EBCB5E3A53143CEB2C511B1AE0AF5AC827F60F2FD872565AC5CA0A164038FE980A7E4BD" ECP selftest depends_on:POLARSSL_SELF_TEST diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function index 543175f30..042077ee4 100644 --- a/tests/suites/test_suite_ecp.function +++ b/tests/suites/test_suite_ecp.function @@ -1,13 +1,17 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER -BEGIN_DEPENDENCIES -depends_on:POLARSSL_ECP_C:POLARSSL_BIGNUM_C -END_DEPENDENCIES +#define POLARSSL_ECP_PF_UNKNOWN -1 +/* END_HEADER */ -BEGIN_CASE -ecp_small_add:a_zero:x_a:y_a:b_zero:x_b:y_b:c_zero:x_c:y_c +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_ECP_C:POLARSSL_BIGNUM_C + * END_DEPENDENCIES + */ + +/* BEGIN_CASE */ +void ecp_small_add( int a_zero, char *x_a, char *y_a, int b_zero, char *x_b, + char *y_b, int c_zero, int x_c, int y_c ) { ecp_group grp; ecp_point A, B, C; @@ -18,43 +22,44 @@ ecp_small_add:a_zero:x_a:y_a:b_zero:x_b:y_b:c_zero:x_c:y_c TEST_ASSERT( ecp_group_read_string( &grp, 10, "47", "4", "17", "42", "13" ) == 0 ); - if( {a_zero} ) + if( a_zero ) ecp_set_zero( &A ); else - TEST_ASSERT( ecp_point_read_string( &A, 10, {x_a}, {y_a} ) == 0 ); + TEST_ASSERT( ecp_point_read_string( &A, 10, x_a, y_a ) == 0 ); - if( {b_zero} ) + if( b_zero ) ecp_set_zero( &B ); else - TEST_ASSERT( ecp_point_read_string( &B, 10, {x_b}, {y_b} ) == 0 ); + TEST_ASSERT( ecp_point_read_string( &B, 10, x_b, y_b ) == 0 ); TEST_ASSERT( ecp_add( &grp, &C, &A, &B ) == 0 ); - if( {c_zero} ) + if( c_zero ) TEST_ASSERT( mpi_cmp_int( &C.Z, 0 ) == 0 ); else { - TEST_ASSERT( mpi_cmp_int( &C.X, {x_c} ) == 0 ); - TEST_ASSERT( mpi_cmp_int( &C.Y, {y_c} ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &C.X, x_c ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &C.Y, y_c ) == 0 ); } TEST_ASSERT( ecp_add( &grp, &C, &B, &A ) == 0 ); - if( {c_zero} ) + if( c_zero ) TEST_ASSERT( mpi_cmp_int( &C.Z, 0 ) == 0 ); else { - TEST_ASSERT( mpi_cmp_int( &C.X, {x_c} ) == 0 ); - TEST_ASSERT( mpi_cmp_int( &C.Y, {y_c} ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &C.X, x_c ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &C.Y, y_c ) == 0 ); } ecp_group_free( &grp ); ecp_point_free( &A ); ecp_point_free( &B ); ecp_point_free( &C ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_small_sub:a_zero:x_a:y_a:b_zero:x_b:y_b:c_zero:x_c:y_c +/* BEGIN_CASE */ +void ecp_small_sub( int a_zero, char *x_a, char *y_a, int b_zero, char *x_b, + char *y_b, int c_zero, int x_c, int y_c ) { ecp_group grp; ecp_point A, B, C; @@ -65,33 +70,33 @@ ecp_small_sub:a_zero:x_a:y_a:b_zero:x_b:y_b:c_zero:x_c:y_c TEST_ASSERT( ecp_group_read_string( &grp, 10, "47", "4", "17", "42", "13" ) == 0 ); - if( {a_zero} ) + if( a_zero ) ecp_set_zero( &A ); else - TEST_ASSERT( ecp_point_read_string( &A, 10, {x_a}, {y_a} ) == 0 ); + TEST_ASSERT( ecp_point_read_string( &A, 10, x_a, y_a ) == 0 ); - if( {b_zero} ) + if( b_zero ) ecp_set_zero( &B ); else - TEST_ASSERT( ecp_point_read_string( &B, 10, {x_b}, {y_b} ) == 0 ); + TEST_ASSERT( ecp_point_read_string( &B, 10, x_b, y_b ) == 0 ); TEST_ASSERT( ecp_sub( &grp, &C, &A, &B ) == 0 ); - if( {c_zero} ) + if( c_zero ) TEST_ASSERT( mpi_cmp_int( &C.Z, 0 ) == 0 ); else { - TEST_ASSERT( mpi_cmp_int( &C.X, {x_c} ) == 0 ); - TEST_ASSERT( mpi_cmp_int( &C.Y, {y_c} ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &C.X, x_c ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &C.Y, y_c ) == 0 ); } ecp_group_free( &grp ); ecp_point_free( &A ); ecp_point_free( &B ); ecp_point_free( &C ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_small_mul:m:r_zero:x_r:y_r:ret +/* BEGIN_CASE */ +void ecp_small_mul( int m_str, int r_zero, int x_r, int y_r, int ret ) { ecp_group grp; ecp_point R; @@ -104,26 +109,26 @@ ecp_small_mul:m:r_zero:x_r:y_r:ret TEST_ASSERT( ecp_group_read_string( &grp, 10, "47", "4", "17", "42", "13" ) == 0 ); - TEST_ASSERT( mpi_lset( &m, {m} ) == 0 ); + TEST_ASSERT( mpi_lset( &m, m_str ) == 0 ); - TEST_ASSERT( ecp_mul( &grp, &R, &m, &grp.G ) == {ret} ); + TEST_ASSERT( ecp_mul( &grp, &R, &m, &grp.G ) == ret ); - if( {r_zero} ) + if( r_zero ) TEST_ASSERT( mpi_cmp_int( &R.Z, 0 ) == 0 ); else { - TEST_ASSERT( mpi_cmp_int( &R.X, {x_r} ) == 0 ); - TEST_ASSERT( mpi_cmp_int( &R.Y, {y_r} ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &R.X, x_r ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &R.Y, y_r ) == 0 ); } ecp_group_free( &grp ); ecp_point_free( &R ); mpi_free( &m ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_small_check_pub:x:y:z:ret +/* BEGIN_CASE */ +void ecp_small_check_pub( int x, int y, int z, int ret ) { ecp_group grp; ecp_point P; @@ -134,19 +139,21 @@ ecp_small_check_pub:x:y:z:ret TEST_ASSERT( ecp_group_read_string( &grp, 10, "47", "4", "17", "42", "13" ) == 0 ); - TEST_ASSERT( mpi_lset( &P.X, {x} ) == 0 ); - TEST_ASSERT( mpi_lset( &P.Y, {y} ) == 0 ); - TEST_ASSERT( mpi_lset( &P.Z, {z} ) == 0 ); + TEST_ASSERT( mpi_lset( &P.X, x ) == 0 ); + TEST_ASSERT( mpi_lset( &P.Y, y ) == 0 ); + TEST_ASSERT( mpi_lset( &P.Z, z ) == 0 ); - TEST_ASSERT( ecp_check_pubkey( &grp, &P ) == {ret} ); + TEST_ASSERT( ecp_check_pubkey( &grp, &P ) == ret ); ecp_group_free( &grp ); ecp_point_free( &P ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_test_vect:id:dA:xA:yA:dB:xB:yB:xZ:yZ +/* BEGIN_CASE */ +void ecp_test_vect( int id, char *dA_str, char *xA_str, char *yA_str, + char *dB_str, char *xB_str, char *yB_str, char *xZ_str, + char *yZ_str ) { ecp_group grp; ecp_point R; @@ -156,18 +163,18 @@ ecp_test_vect:id:dA:xA:yA:dB:xB:yB:xZ:yZ mpi_init( &dA ); mpi_init( &xA ); mpi_init( &yA ); mpi_init( &dB ); mpi_init( &xB ); mpi_init( &yB ); mpi_init( &xZ ); mpi_init( &yZ ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); TEST_ASSERT( ecp_check_pubkey( &grp, &grp.G ) == 0 ); - TEST_ASSERT( mpi_read_string( &dA, 16, {dA} ) == 0 ); - TEST_ASSERT( mpi_read_string( &xA, 16, {xA} ) == 0 ); - TEST_ASSERT( mpi_read_string( &yA, 16, {yA} ) == 0 ); - TEST_ASSERT( mpi_read_string( &dB, 16, {dB} ) == 0 ); - TEST_ASSERT( mpi_read_string( &xB, 16, {xB} ) == 0 ); - TEST_ASSERT( mpi_read_string( &yB, 16, {yB} ) == 0 ); - TEST_ASSERT( mpi_read_string( &xZ, 16, {xZ} ) == 0 ); - TEST_ASSERT( mpi_read_string( &yZ, 16, {yZ} ) == 0 ); + TEST_ASSERT( mpi_read_string( &dA, 16, dA_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &xA, 16, xA_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &yA, 16, yA_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &dB, 16, dB_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &xB, 16, xB_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &yB, 16, yB_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &xZ, 16, xZ_str ) == 0 ); + TEST_ASSERT( mpi_read_string( &yZ, 16, yZ_str ) == 0 ); TEST_ASSERT( ecp_mul( &grp, &R, &dA, &grp.G ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &R.X, &xA ) == 0 ); @@ -191,10 +198,10 @@ ecp_test_vect:id:dA:xA:yA:dB:xB:yB:xZ:yZ mpi_free( &dA ); mpi_free( &xA ); mpi_free( &yA ); mpi_free( &dB ); mpi_free( &xB ); mpi_free( &yB ); mpi_free( &xZ ); mpi_free( &yZ ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_fast_mod:id:N +/* BEGIN_CASE */ +void ecp_fast_mod( int id, char *N_str ) { ecp_group grp; mpi N, R; @@ -202,8 +209,8 @@ ecp_fast_mod:id:N mpi_init( &N ); mpi_init( &R ); ecp_group_init( &grp ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); - TEST_ASSERT( mpi_read_string( &N, 16, {N} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); + TEST_ASSERT( mpi_read_string( &N, 16, N_str ) == 0 ); /* * Store correct result before we touch N @@ -222,10 +229,11 @@ ecp_fast_mod:id:N mpi_free( &N ); mpi_free( &R ); ecp_group_free( &grp ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_write_binary:id:x:y:z:format:out:blen:ret +/* BEGIN_CASE */ +void ecp_write_binary( int id, char *x, char *y, char *z, int format, + char *out, int blen, int ret ) { ecp_group grp; ecp_point P; @@ -237,28 +245,28 @@ ecp_write_binary:id:x:y:z:format:out:blen:ret ecp_group_init( &grp ); ecp_point_init( &P ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); - TEST_ASSERT( mpi_read_string( &P.X, 16, {x} ) == 0 ); - TEST_ASSERT( mpi_read_string( &P.Y, 16, {y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &P.Z, 16, {z} ) == 0 ); + TEST_ASSERT( mpi_read_string( &P.X, 16, x ) == 0 ); + TEST_ASSERT( mpi_read_string( &P.Y, 16, y ) == 0 ); + TEST_ASSERT( mpi_read_string( &P.Z, 16, z ) == 0 ); -#define POLARSSL_ECP_PF_UNKNOWN -1 - TEST_ASSERT( ecp_point_write_binary( &grp, &P, POLARSSL_ECP_PF_{format}, - &olen, buf, {blen} ) == {ret} ); + TEST_ASSERT( ecp_point_write_binary( &grp, &P, format, + &olen, buf, blen ) == ret ); - if( {ret} == 0 ) + if( ret == 0 ) { hexify( str, buf, olen ); - TEST_ASSERT( strcasecmp( (char *) str, {out} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) str, out ) == 0 ); } ecp_group_free( &grp ); ecp_point_free( &P ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_read_binary:id:input:x:y:z:ret +/* BEGIN_CASE */ +void ecp_read_binary( int id, char *input, char *x, char *y, char *z, + int ret ) { ecp_group grp; ecp_point P; @@ -271,17 +279,17 @@ ecp_read_binary:id:input:x:y:z:ret ecp_group_init( &grp ); ecp_point_init( &P ); mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); - TEST_ASSERT( mpi_read_string( &X, 16, {x} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, 16, {y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Z, 16, {z} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, 16, x ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, 16, y ) == 0 ); + TEST_ASSERT( mpi_read_string( &Z, 16, z ) == 0 ); - ilen = unhexify( buf, {input} ); + ilen = unhexify( buf, input ); - TEST_ASSERT( ecp_point_read_binary( &grp, &P, buf, ilen ) == {ret} ); + TEST_ASSERT( ecp_point_read_binary( &grp, &P, buf, ilen ) == ret ); - if( {ret} == 0 ) + if( ret == 0 ) { TEST_ASSERT( mpi_cmp_mpi( &P.X, &X ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &P.Y, &Y ) == 0 ); @@ -291,10 +299,11 @@ ecp_read_binary:id:input:x:y:z:ret ecp_group_free( &grp ); ecp_point_free( &P ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_tls_read_point:id:input:x:y:z:ret +/* BEGIN_CASE */ +void ecp_tls_read_point( int id, char *input, char *x, char *y, char *z, + int ret ) { ecp_group grp; ecp_point P; @@ -308,17 +317,17 @@ ecp_tls_read_point:id:input:x:y:z:ret ecp_group_init( &grp ); ecp_point_init( &P ); mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); - TEST_ASSERT( mpi_read_string( &X, 16, {x} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, 16, {y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Z, 16, {z} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, 16, x ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, 16, y ) == 0 ); + TEST_ASSERT( mpi_read_string( &Z, 16, z ) == 0 ); - ilen = unhexify( buf, {input} ); + ilen = unhexify( buf, input ); - TEST_ASSERT( ecp_tls_read_point( &grp, &P, &vbuf, ilen ) == {ret} ); + TEST_ASSERT( ecp_tls_read_point( &grp, &P, &vbuf, ilen ) == ret ); - if( {ret} == 0 ) + if( ret == 0 ) { TEST_ASSERT( mpi_cmp_mpi( &P.X, &X ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &P.Y, &Y ) == 0 ); @@ -329,10 +338,10 @@ ecp_tls_read_point:id:input:x:y:z:ret ecp_group_free( &grp ); ecp_point_free( &P ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_tls_write_read_point:id +/* BEGIN_CASE */ +void ecp_tls_write_read_point( int id ) { ecp_group grp; ecp_point pt; @@ -343,7 +352,7 @@ ecp_tls_write_read_point:id ecp_group_init( &grp ); ecp_point_init( &pt ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); memset( buf, 0x00, sizeof( buf ) ); vbuf = buf; TEST_ASSERT( ecp_tls_write_point( &grp, &grp.G, @@ -380,10 +389,10 @@ ecp_tls_write_read_point:id ecp_group_free( &grp ); ecp_point_free( &pt ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_tls_read_group:record:ret:bits +/* BEGIN_CASE */ +void ecp_tls_read_group( char *record, int result, int bits ) { ecp_group grp; unsigned char buf[10]; @@ -393,23 +402,23 @@ ecp_tls_read_group:record:ret:bits ecp_group_init( &grp ); memset( buf, 0x00, sizeof( buf ) ); - len = unhexify( buf, {record} ); + len = unhexify( buf, record ); ret = ecp_tls_read_group( &grp, &vbuf, len ); - TEST_ASSERT( ret == {ret} ); + TEST_ASSERT( ret == result ); if( ret == 0) { - TEST_ASSERT( mpi_msb( &grp.P ) == {bits} ); + TEST_ASSERT( mpi_msb( &grp.P ) == (size_t) bits ); TEST_ASSERT( *vbuf == 0x00 ); } ecp_group_free( &grp ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_tls_write_read_group:id +/* BEGIN_CASE */ +void ecp_tls_write_read_group( int id ) { ecp_group grp1, grp2; unsigned char buf[10]; @@ -421,7 +430,7 @@ ecp_tls_write_read_group:id ecp_group_init( &grp2 ); memset( buf, 0x00, sizeof( buf ) ); - TEST_ASSERT( ecp_use_known_dp( &grp1, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp1, id ) == 0 ); TEST_ASSERT( ecp_tls_write_group( &grp1, &len, buf, 10 ) == 0 ); TEST_ASSERT( ( ret = ecp_tls_read_group( &grp2, &vbuf, len ) ) == 0 ); @@ -435,10 +444,10 @@ ecp_tls_write_read_group:id ecp_group_free( &grp1 ); ecp_group_free( &grp2 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_check_privkey:id +/* BEGIN_CASE */ +void ecp_check_privkey( int id ) { ecp_group grp; mpi d; @@ -446,7 +455,7 @@ ecp_check_privkey:id ecp_group_init( &grp ); mpi_init( &d ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); TEST_ASSERT( mpi_lset( &d, 0 ) == 0 ); TEST_ASSERT( ecp_check_privkey( &grp, &d ) == POLARSSL_ERR_ECP_GENERIC ); @@ -457,10 +466,10 @@ ecp_check_privkey:id ecp_group_free( &grp ); mpi_free( &d ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_gen_keypair:id +/* BEGIN_CASE */ +void ecp_gen_keypair( int id ) { ecp_group grp; ecp_point Q; @@ -472,7 +481,7 @@ ecp_gen_keypair:id mpi_init( &d ); memset( &rnd_info, 0x00, sizeof( rnd_pseudo_info ) ); - TEST_ASSERT( ecp_use_known_dp( &grp, POLARSSL_ECP_DP_{id} ) == 0 ); + TEST_ASSERT( ecp_use_known_dp( &grp, id ) == 0 ); TEST_ASSERT( ecp_gen_keypair( &grp, &d, &Q, &rnd_pseudo_rand, &rnd_info ) == 0 ); @@ -484,11 +493,11 @@ ecp_gen_keypair:id ecp_point_free( &Q ); mpi_free( &d ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -ecp_selftest: +/* BEGIN_CASE */ +void ecp_selftest() { TEST_ASSERT( ecp_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_error.function b/tests/suites/test_suite_error.function index df6e857b0..4129f3daa 100644 --- a/tests/suites/test_suite_error.function +++ b/tests/suites/test_suite_error.function @@ -1,18 +1,19 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_ERROR_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_ERROR_C + * END_DEPENDENCIES + */ -BEGIN_CASE -error_strerror:code:result_str +/* BEGIN_CASE */ +void error_strerror( int code, char *result_str ) { char buf[500]; - error_strerror( {code}, buf, 500 ); + error_strerror( code, buf, 500 ); - TEST_ASSERT( strcmp( buf, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( buf, result_str ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_gcm.function b/tests/suites/test_suite_gcm.function index 0a854e231..c00ec0b10 100644 --- a/tests/suites/test_suite_gcm.function +++ b/tests/suites/test_suite_gcm.function @@ -1,13 +1,17 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_GCM_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_GCM_C + * END_DEPENDENCIES + */ -BEGIN_CASE -gcm_encrypt_and_tag:hex_key_string:hex_src_string:hex_iv_string:hex_add_string:hex_dst_string:tag_len:hex_tag_string:init_result +/* BEGIN_CASE */ +void gcm_encrypt_and_tag( char *hex_key_string, char *hex_src_string, + char *hex_iv_string, char *hex_add_string, + char *hex_dst_string, int tag_len_bits, + char *hex_tag_string, int init_result ) { unsigned char key_str[128]; unsigned char src_str[128]; @@ -19,7 +23,7 @@ gcm_encrypt_and_tag:hex_key_string:hex_src_string:hex_iv_string:hex_add_string:h unsigned char tag_output[16]; gcm_context ctx; unsigned int key_len; - size_t pt_len, iv_len, add_len, tag_len = {tag_len} / 8; + size_t pt_len, iv_len, add_len, tag_len = tag_len_bits / 8; memset(key_str, 0x00, 128); memset(src_str, 0x00, 128); @@ -30,26 +34,29 @@ gcm_encrypt_and_tag:hex_key_string:hex_src_string:hex_iv_string:hex_add_string:h memset(output, 0x00, 128); memset(tag_output, 0x00, 16); - key_len = unhexify( key_str, {hex_key_string} ); - pt_len = unhexify( src_str, {hex_src_string} ); - iv_len = unhexify( iv_str, {hex_iv_string} ); - add_len = unhexify( add_str, {hex_add_string} ); + key_len = unhexify( key_str, hex_key_string ); + pt_len = unhexify( src_str, hex_src_string ); + iv_len = unhexify( iv_str, hex_iv_string ); + add_len = unhexify( add_str, hex_add_string ); - TEST_ASSERT( gcm_init( &ctx, key_str, key_len * 8 ) == {init_result} ); - if( {init_result} == 0 ) + TEST_ASSERT( gcm_init( &ctx, key_str, key_len * 8 ) == init_result ); + if( init_result == 0 ) { TEST_ASSERT( gcm_crypt_and_tag( &ctx, GCM_ENCRYPT, pt_len, iv_str, iv_len, add_str, add_len, src_str, output, tag_len, tag_output ) == 0 ); hexify( dst_str, output, pt_len ); hexify( tag_str, tag_output, tag_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); - TEST_ASSERT( strcmp( (char *) tag_str, {hex_tag_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); + TEST_ASSERT( strcmp( (char *) tag_str, hex_tag_string ) == 0 ); } } -END_CASE +/* END_CASE */ -BEGIN_CASE -gcm_decrypt_and_verify:hex_key_string:hex_src_string:hex_iv_string:hex_add_string:tag_len:hex_tag_string:pt_result:init_result +/* BEGIN_CASE */ +void gcm_decrypt_and_verify( char *hex_key_string, char *hex_src_string, + char *hex_iv_string, char *hex_add_string, + int tag_len_bits, char *hex_tag_string, + char *pt_result, int init_result ) { unsigned char key_str[128]; unsigned char src_str[128]; @@ -60,7 +67,7 @@ gcm_decrypt_and_verify:hex_key_string:hex_src_string:hex_iv_string:hex_add_strin unsigned char output[128]; gcm_context ctx; unsigned int key_len; - size_t pt_len, iv_len, add_len, tag_len = {tag_len} / 8; + size_t pt_len, iv_len, add_len, tag_len = tag_len_bits / 8; int ret; memset(key_str, 0x00, 128); @@ -71,18 +78,18 @@ gcm_decrypt_and_verify:hex_key_string:hex_src_string:hex_iv_string:hex_add_strin memset(tag_str, 0x00, 128); memset(output, 0x00, 128); - key_len = unhexify( key_str, {hex_key_string} ); - pt_len = unhexify( src_str, {hex_src_string} ); - iv_len = unhexify( iv_str, {hex_iv_string} ); - add_len = unhexify( add_str, {hex_add_string} ); - unhexify( tag_str, {hex_tag_string} ); + key_len = unhexify( key_str, hex_key_string ); + pt_len = unhexify( src_str, hex_src_string ); + iv_len = unhexify( iv_str, hex_iv_string ); + add_len = unhexify( add_str, hex_add_string ); + unhexify( tag_str, hex_tag_string ); - TEST_ASSERT( gcm_init( &ctx, key_str, key_len * 8 ) == {init_result} ); - if( {init_result} == 0 ) + TEST_ASSERT( gcm_init( &ctx, key_str, key_len * 8 ) == init_result ); + if( init_result == 0 ) { ret = gcm_auth_decrypt( &ctx, pt_len, iv_str, iv_len, add_str, add_len, tag_str, tag_len, src_str, output ); - if( strcmp( "FAIL", {pt_result} ) == 0 ) + if( strcmp( "FAIL", pt_result ) == 0 ) { TEST_ASSERT( ret == POLARSSL_ERR_GCM_AUTH_FAILED ); } @@ -90,15 +97,15 @@ gcm_decrypt_and_verify:hex_key_string:hex_src_string:hex_iv_string:hex_add_strin { hexify( dst_str, output, pt_len ); - TEST_ASSERT( strcmp( (char *) dst_str, {pt_result} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, pt_result ) == 0 ); } } } -END_CASE +/* END_CASE */ -BEGIN_CASE -gcm_selftest: +/* BEGIN_CASE */ +void gcm_selftest() { TEST_ASSERT( gcm_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_hmac_shax.function b/tests/suites/test_suite_hmac_shax.function index 214002b59..4a1532266 100644 --- a/tests/suites/test_suite_hmac_shax.function +++ b/tests/suites/test_suite_hmac_shax.function @@ -1,11 +1,12 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include #include #include -END_HEADER +/* END_HEADER */ -BEGIN_CASE -sha1_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA1_C */ +void sha1_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string) { unsigned char src_str[10000]; unsigned char key_str[10000]; @@ -18,18 +19,19 @@ sha1_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 41); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); sha1_hmac( key_str, key_len, src_str, src_len, output ); hexify( hash_str, output, 20 ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha224_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA256_C */ +void sha224_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string) { unsigned char src_str[10000]; unsigned char key_str[10000]; @@ -42,18 +44,19 @@ sha224_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 57); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); sha256_hmac( key_str, key_len, src_str, src_len, output, 1 ); hexify( hash_str, output, 28 ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha256_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA256_C */ +void sha256_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string) { unsigned char src_str[10000]; unsigned char key_str[10000]; @@ -66,18 +69,19 @@ sha256_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 65); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); sha256_hmac( key_str, key_len, src_str, src_len, output, 0 ); hexify( hash_str, output, 32 ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha384_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA512_C */ +void sha384_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string) { unsigned char src_str[10000]; unsigned char key_str[10000]; @@ -90,18 +94,19 @@ sha384_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 97); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); sha512_hmac( key_str, key_len, src_str, src_len, output, 1 ); hexify( hash_str, output, 48 ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha512_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA512_C */ +void sha512_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string) { unsigned char src_str[10000]; unsigned char key_str[10000]; @@ -114,12 +119,12 @@ sha512_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 129); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); sha512_hmac( key_str, key_len, src_str, src_len, output, 0 ); hexify( hash_str, output, 64 ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_md.function b/tests/suites/test_suite_md.function index 81d8f0364..042af17e2 100644 --- a/tests/suites/test_suite_md.function +++ b/tests/suites/test_suite_md.function @@ -1,4 +1,4 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include #include #include @@ -6,14 +6,15 @@ BEGIN_HEADER #include #include #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_MD_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_MD_C + * END_DEPENDENCIES + */ -BEGIN_CASE -md_text:text_md_name:text_src_string:hex_hash_string +/* BEGIN_CASE */ +void md_text( char *text_md_name, char *text_src_string, char *hex_hash_string ) { char md_name[100]; unsigned char src_str[1000]; @@ -26,21 +27,21 @@ md_text:text_md_name:text_src_string:hex_hash_string memset(hash_str, 0x00, 1000); memset(output, 0x00, 100); - strcpy( (char *) src_str, {text_src_string} ); + strcpy( (char *) src_str, text_src_string ); - strncpy( (char *) md_name, {text_md_name}, 100 ); + strncpy( (char *) md_name, text_md_name, 100 ); md_info = md_info_from_string(md_name); TEST_ASSERT( md_info != NULL ); TEST_ASSERT ( 0 == md( md_info, src_str, strlen( (char *) src_str ), output ) ); hexify( hash_str, output, md_get_size(md_info) ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md_hex:text_md_name:hex_src_string:hex_hash_string +/* BEGIN_CASE */ +void md_hex( char *text_md_name, char *hex_src_string, char *hex_hash_string ) { char md_name[100]; unsigned char src_str[10000]; @@ -54,21 +55,22 @@ md_hex:text_md_name:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 100); - strncpy( (char *) md_name, {text_md_name}, 100 ); + strncpy( (char *) md_name, text_md_name, 100 ); md_info = md_info_from_string(md_name); TEST_ASSERT( md_info != NULL ); - src_len = unhexify( src_str, {hex_src_string} ); + src_len = unhexify( src_str, hex_src_string ); TEST_ASSERT ( 0 == md( md_info, src_str, src_len, output ) ); hexify( hash_str, output, md_get_size(md_info) ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md_text_multi:text_md_name:text_src_string:hex_hash_string +/* BEGIN_CASE */ +void md_text_multi( char *text_md_name, char *text_src_string, + char *hex_hash_string ) { char md_name[100]; unsigned char src_str[1000]; @@ -83,9 +85,9 @@ md_text_multi:text_md_name:text_src_string:hex_hash_string memset(hash_str, 0x00, 1000); memset(output, 0x00, 100); - strcpy( (char *) src_str, {text_src_string} ); + strcpy( (char *) src_str, text_src_string ); - strncpy( (char *) md_name, {text_md_name}, 100 ); + strncpy( (char *) md_name, text_md_name, 100 ); md_info = md_info_from_string(md_name); TEST_ASSERT( md_info != NULL ); TEST_ASSERT ( 0 == md_init_ctx( &ctx, md_info ) ); @@ -98,12 +100,13 @@ md_text_multi:text_md_name:text_src_string:hex_hash_string hexify( hash_str, output, md_get_size(md_info) ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md_hex_multi:text_md_name:hex_src_string:hex_hash_string +/* BEGIN_CASE */ +void md_hex_multi( char *text_md_name, char *hex_src_string, + char *hex_hash_string ) { char md_name[100]; unsigned char src_str[10000]; @@ -118,12 +121,12 @@ md_hex_multi:text_md_name:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 100); - strncpy( (char *) md_name, {text_md_name}, 100 ); + strncpy( (char *) md_name, text_md_name, 100 ); md_info = md_info_from_string(md_name); TEST_ASSERT( md_info != NULL ); TEST_ASSERT ( 0 == md_init_ctx( &ctx, md_info ) ); - src_len = unhexify( src_str, {hex_src_string} ); + src_len = unhexify( src_str, hex_src_string ); TEST_ASSERT ( 0 == md_starts( &ctx ) ); TEST_ASSERT ( ctx.md_ctx != NULL ); @@ -133,12 +136,13 @@ md_hex_multi:text_md_name:hex_src_string:hex_hash_string hexify( hash_str, output, md_get_size(md_info) ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md_hmac:text_md_name:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE */ +void md_hmac( char *text_md_name, int trunc_size, char *hex_key_string, + char *hex_src_string, char *hex_hash_string ) { char md_name[100]; unsigned char src_str[10000]; @@ -154,22 +158,23 @@ md_hmac:text_md_name:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 100); - strncpy( (char *) md_name, {text_md_name}, 100 ); + strncpy( (char *) md_name, text_md_name, 100 ); md_info = md_info_from_string( md_name ); TEST_ASSERT( md_info != NULL ); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); TEST_ASSERT ( md_hmac( md_info, key_str, key_len, src_str, src_len, output ) == 0 ); hexify( hash_str, output, md_get_size(md_info) ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md_hmac_multi:text_md_name:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE */ +void md_hmac_multi( char *text_md_name, int trunc_size, char *hex_key_string, + char *hex_src_string, char *hex_hash_string ) { char md_name[100]; unsigned char src_str[10000]; @@ -186,27 +191,27 @@ md_hmac_multi:text_md_name:trunc_size:hex_key_string:hex_src_string:hex_hash_str memset(hash_str, 0x00, 10000); memset(output, 0x00, 100); - strncpy( (char *) md_name, {text_md_name}, 100 ); + strncpy( (char *) md_name, text_md_name, 100 ); md_info = md_info_from_string( md_name ); TEST_ASSERT( md_info != NULL ); TEST_ASSERT ( 0 == md_init_ctx( &ctx, md_info ) ); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); TEST_ASSERT ( 0 == md_hmac_starts( &ctx, key_str, key_len ) ); TEST_ASSERT ( ctx.md_ctx != NULL ); TEST_ASSERT ( 0 == md_hmac_update( &ctx, src_str, src_len ) ); TEST_ASSERT ( 0 == md_hmac_finish( &ctx, output ) ); TEST_ASSERT ( 0 == md_free_ctx( &ctx ) ); - + hexify( hash_str, output, md_get_size(md_info) ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE -BEGIN_CASE -md_file:text_md_name:filename:hex_hash_string +/* END_CASE */ +/* BEGIN_CASE */ +void md_file( char *text_md_name, char *filename, char *hex_hash_string ) { char md_name[100]; unsigned char hash_str[1000]; @@ -217,13 +222,13 @@ md_file:text_md_name:filename:hex_hash_string memset(hash_str, 0x00, 1000); memset(output, 0x00, 100); - strncpy( (char *) md_name, {text_md_name}, 100 ); + strncpy( (char *) md_name, text_md_name, 100 ); md_info = md_info_from_string( md_name ); TEST_ASSERT( md_info != NULL ); - md_file( md_info, {filename}, output); + md_file( md_info, filename, output); hexify( hash_str, output, md_get_size(md_info) ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_mdx.function b/tests/suites/test_suite_mdx.function index 30ca36a0d..53a68014d 100644 --- a/tests/suites/test_suite_mdx.function +++ b/tests/suites/test_suite_mdx.function @@ -1,11 +1,11 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include #include #include -END_HEADER +/* END_HEADER */ -BEGIN_CASE -md2_text:text_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD2_C */ +void md2_text( char *text_src_string, char *hex_hash_string ) { unsigned char src_str[1000]; unsigned char hash_str[1000]; @@ -15,17 +15,17 @@ md2_text:text_src_string:hex_hash_string memset(hash_str, 0x00, 1000); memset(output, 0x00, 33); - strcpy( (char *) src_str, {text_src_string} ); + strcpy( (char *) src_str, text_src_string ); md2( src_str, strlen( (char *) src_str ), output ); hexify( hash_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md4_text:text_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD4_C */ +void md4_text( char *text_src_string, char *hex_hash_string ) { unsigned char src_str[1000]; unsigned char hash_str[1000]; @@ -35,17 +35,17 @@ md4_text:text_src_string:hex_hash_string memset(hash_str, 0x00, 1000); memset(output, 0x00, 33); - strcpy( (char *) src_str, {text_src_string} ); + strcpy( (char *) src_str, text_src_string ); md4( src_str, strlen( (char *) src_str ), output ); hexify( hash_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md5_text:text_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD5_C */ +void md5_text( char *text_src_string, char *hex_hash_string ) { unsigned char src_str[1000]; unsigned char hash_str[1000]; @@ -55,17 +55,18 @@ md5_text:text_src_string:hex_hash_string memset(hash_str, 0x00, 1000); memset(output, 0x00, 33); - strcpy( (char *) src_str, {text_src_string} ); + strcpy( (char *) src_str, text_src_string ); md5( src_str, strlen( (char *) src_str ), output ); hexify( hash_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md2_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD2_C */ +void md2_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string ) { unsigned char src_str[10000]; unsigned char key_str[10000]; @@ -78,18 +79,19 @@ md2_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 33); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); md2_hmac( key_str, key_len, src_str, src_len, output ); hexify( hash_str, output, 16 ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md4_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD4_C */ +void md4_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string ) { unsigned char src_str[10000]; unsigned char key_str[10000]; @@ -102,18 +104,19 @@ md4_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 33); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); md4_hmac( key_str, key_len, src_str, src_len, output ); hexify( hash_str, output, 16 ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md5_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD5_C */ +void md5_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string ) { unsigned char src_str[10000]; unsigned char key_str[10000]; @@ -126,18 +129,18 @@ md5_hmac:trunc_size:hex_key_string:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 33); - key_len = unhexify( key_str, {hex_key_string} ); - src_len = unhexify( src_str, {hex_src_string} ); + key_len = unhexify( key_str, hex_key_string ); + src_len = unhexify( src_str, hex_src_string ); md5_hmac( key_str, key_len, src_str, src_len, output ); hexify( hash_str, output, 16 ); - TEST_ASSERT( strncmp( (char *) hash_str, {hex_hash_string}, {trunc_size} * 2 ) == 0 ); + TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md2_file:filename:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD2_C */ +void md2_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[65]; unsigned char output[33]; @@ -145,15 +148,15 @@ md2_file:filename:hex_hash_string memset(hash_str, 0x00, 65); memset(output, 0x00, 33); - md2_file( {filename}, output); + md2_file( filename, output); hexify( hash_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md4_file:filename:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD4_C */ +void md4_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[65]; unsigned char output[33]; @@ -161,15 +164,15 @@ md4_file:filename:hex_hash_string memset(hash_str, 0x00, 65); memset(output, 0x00, 33); - md4_file( {filename}, output); + md4_file( filename, output); hexify( hash_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md5_file:filename:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_MD5_C */ +void md5_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[65]; unsigned char output[33]; @@ -177,30 +180,30 @@ md5_file:filename:hex_hash_string memset(hash_str, 0x00, 65); memset(output, 0x00, 33); - md5_file( {filename}, output); + md5_file( filename, output); hexify( hash_str, output, 16 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md2_selftest: +/* BEGIN_CASE depends_on:POLARSSL_MD2_C */ +void md2_selftest() { TEST_ASSERT( md2_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md4_selftest: +/* BEGIN_CASE depends_on:POLARSSL_MD4_C */ +void md4_selftest() { TEST_ASSERT( md4_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -md5_selftest: +/* BEGIN_CASE depends_on:POLARSSL_MD5_C */ +void md5_selftest() { TEST_ASSERT( md5_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_mpi.data b/tests/suites/test_suite_mpi.data index 7197b6301..5f88ba787 100644 --- a/tests/suites/test_suite_mpi.data +++ b/tests/suites/test_suite_mpi.data @@ -67,7 +67,7 @@ mpi_read_file:10:"data_files/mpi_too_big":"":POLARSSL_ERR_MPI_BUFFER_TOO_SMALL Base test mpi_write_file #1 depends_on:POLARSSL_FS_IO -mpi_write_file:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":16:"data_files/mpi_write":0 +mpi_write_file:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":16:"data_files/mpi_write" Base test mpi_lsb #1 mpi_lsb:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":2 @@ -337,16 +337,16 @@ Test mpi_mul_mpi #1 mpi_mul_mpi:10:"28911710017320205966167820725313234361535259163045867986277478145081076845846493521348693253530011243988160148063424837895971948244167867236923919506962312185829914482993478947657472351461336729641485069323635424692930278888923450060546465883490944265147851036817433970984747733020522259537":10:"16471581891701794764704009719057349996270239948993452268812975037240586099924712715366967486587417803753916334331355573776945238871512026832810626226164346328807407669366029926221415383560814338828449642265377822759768011406757061063524768140567867350208554439342320410551341675119078050953":10:"476221599179424887669515829231223263939342135681791605842540429321038144633323941248706405375723482912535192363845116154236465184147599697841273424891410002781967962186252583311115708128167171262206919514587899883547279647025952837516324649656913580411611297312678955801899536937577476819667861053063432906071315727948826276092545739432005962781562403795455162483159362585281248265005441715080197800335757871588045959754547836825977169125866324128449699877076762316768127816074587766799018626179199776188490087103869164122906791440101822594139648973454716256383294690817576188761" Test mpi_mul_int #1 -mpi_mul_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":9871232:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":== +mpi_mul_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":9871232:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":"==" Test mpi_mul_int #2 (Unsigned, thus failure) -mpi_mul_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":-9871232:10:"-20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":!= +mpi_mul_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":-9871232:10:"-20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":"!=" Test mpi_mul_int #3 -mpi_mul_int:10:"-2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":9871232:10:"-20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":== +mpi_mul_int:10:"-2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":9871232:10:"-20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":"==" Test mpi_mul_int #4 (Unsigned, thus failure) -mpi_mul_int:10:"-2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":-9871232:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":!= +mpi_mul_int:10:"-2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":-9871232:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":"!=" Base test mpi_div_mpi #1 mpi_div_mpi:10:"1000":10:"13":10:"76":10:"12":0 diff --git a/tests/suites/test_suite_mpi.function b/tests/suites/test_suite_mpi.function index 70d9b4f18..6a99a60df 100644 --- a/tests/suites/test_suite_mpi.function +++ b/tests/suites/test_suite_mpi.function @@ -1,36 +1,39 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_BIGNUM_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_BIGNUM_C + * END_DEPENDENCIES + */ -BEGIN_CASE -mpi_read_write_string:radix_X:input_X:radix_A:input_A:output_size:result_read:result_write +/* BEGIN_CASE */ +void mpi_read_write_string( int radix_X, char *input_X, int radix_A, + char *input_A, int output_size, int result_read, + int result_write ) { mpi X; char str[1000]; - size_t len = {output_size}; + size_t len = output_size; mpi_init( &X ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == {result_read} ); - if( {result_read} == 0 ) + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == result_read ); + if( result_read == 0 ) { - TEST_ASSERT( mpi_write_string( &X, {radix_A}, str, &len ) == {result_write} ); - if( {result_write} == 0 ) + TEST_ASSERT( mpi_write_string( &X, radix_A, str, &len ) == result_write ); + if( result_write == 0 ) { - TEST_ASSERT( strcasecmp( str, {input_A} ) == 0 ); + TEST_ASSERT( strcasecmp( str, input_A ) == 0 ); } } mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_read_binary:input_X:radix_A:input_A +/* BEGIN_CASE */ +void mpi_read_binary( char *input_X, int radix_A, char *input_A ) { mpi X; unsigned char str[1000]; @@ -40,18 +43,19 @@ mpi_read_binary:input_X:radix_A:input_A mpi_init( &X ); - input_len = unhexify( buf, {input_X} ); + input_len = unhexify( buf, input_X ); TEST_ASSERT( mpi_read_binary( &X, buf, input_len ) == 0 ); - TEST_ASSERT( mpi_write_string( &X, {radix_A}, (char *) str, &len ) == 0 ); - TEST_ASSERT( strcmp( (char *) str, {input_A} ) == 0 ); + TEST_ASSERT( mpi_write_string( &X, radix_A, (char *) str, &len ) == 0 ); + TEST_ASSERT( strcmp( (char *) str, input_A ) == 0 ); mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_write_binary:radix_X:input_X:input_A:output_size:result +/* BEGIN_CASE */ +void mpi_write_binary( int radix_X, char *input_X, char *input_A, + int output_size, int result ) { mpi X; unsigned char str[1000]; @@ -63,26 +67,27 @@ mpi_write_binary:radix_X:input_X:input_A:output_size:result mpi_init( &X ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); buflen = mpi_size( &X ); - if( buflen > {output_size} ) - buflen = {output_size}; + if( buflen > (size_t) output_size ) + buflen = (size_t) output_size; - TEST_ASSERT( mpi_write_binary( &X, buf, buflen ) == {result} ); - if( {result} == 0) + TEST_ASSERT( mpi_write_binary( &X, buf, buflen ) == result ); + if( result == 0) { hexify( str, buf, buflen ); - TEST_ASSERT( strcasecmp( (char *) str, {input_A} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) str, input_A ) == 0 ); } mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_read_file:radix_X:input_file:input_A:result +/* BEGIN_CASE */ +void mpi_read_file( int radix_X, char *input_file, char *input_A, + int result ) { mpi X; unsigned char str[1000]; @@ -95,169 +100,174 @@ mpi_read_file:radix_X:input_file:input_A:result mpi_init( &X ); - file = fopen( {input_file}, "r" ); - TEST_ASSERT( mpi_read_file( &X, {radix_X}, file ) == {result} ); + file = fopen( input_file, "r" ); + TEST_ASSERT( mpi_read_file( &X, radix_X, file ) == result ); fclose(file); - if( {result} == 0 ) + if( result == 0 ) { buflen = mpi_size( &X ); TEST_ASSERT( mpi_write_binary( &X, buf, buflen ) == 0 ); hexify( str, buf, buflen ); - TEST_ASSERT( strcasecmp( (char *) str, {input_A} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) str, input_A ) == 0 ); } mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_write_file:radix_X:input_X:output_radix:output_file +/* BEGIN_CASE */ +void mpi_write_file( int radix_X, char *input_X, int output_radix, + char *output_file ) { mpi X, Y; FILE *file_out, *file_in; mpi_init( &X ); mpi_init( &Y ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); - file_out = fopen( {output_file}, "w" ); + file_out = fopen( output_file, "w" ); TEST_ASSERT( file_out != NULL ); - TEST_ASSERT( mpi_write_file( NULL, &X, {output_radix}, file_out ) == 0 ); + TEST_ASSERT( mpi_write_file( NULL, &X, output_radix, file_out ) == 0 ); fclose(file_out); - file_in = fopen( {output_file}, "r" ); + file_in = fopen( output_file, "r" ); TEST_ASSERT( file_in != NULL ); - TEST_ASSERT( mpi_read_file( &Y, {output_radix}, file_in ) == 0 ); + TEST_ASSERT( mpi_read_file( &Y, output_radix, file_in ) == 0 ); fclose(file_in); TEST_ASSERT( mpi_cmp_mpi( &X, &Y ) == 0 ); mpi_free( &X ); mpi_free( &Y ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_get_bit:radix_X:input_X:pos:val +/* BEGIN_CASE */ +void mpi_get_bit( int radix_X, char *input_X, int pos, int val ) { mpi X; mpi_init( &X ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_get_bit( &X, {pos} ) == {val} ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_get_bit( &X, pos ) == val ); mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_set_bit:radix_X:input_X:pos:val:radix_Y:output_Y +/* BEGIN_CASE */ +void mpi_set_bit( int radix_X, char *input_X, int pos, int val, int radix_Y, + char *output_Y ) { mpi X, Y; mpi_init( &X ); mpi_init( &Y ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {output_Y} ) == 0 ); - TEST_ASSERT( mpi_set_bit( &X, {pos}, {val} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, output_Y ) == 0 ); + TEST_ASSERT( mpi_set_bit( &X, pos, val ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &X, &Y ) == 0 ); mpi_free( &X ); mpi_free( &Y ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_lsb:radix_X:input_X:nr_bits +/* BEGIN_CASE */ +void mpi_lsb( int radix_X, char *input_X, int nr_bits ) { mpi X; mpi_init( &X ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_lsb( &X ) == {nr_bits} ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_lsb( &X ) == (size_t) nr_bits ); mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_msb:radix_X:input_X:nr_bits +/* BEGIN_CASE */ +void mpi_msb( int radix_X, char *input_X, int nr_bits ) { mpi X; mpi_init( &X ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_msb( &X ) == {nr_bits} ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_msb( &X ) == (size_t) nr_bits ); mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_gcd:radix_X:input_X:radix_Y:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_gcd( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A ) { mpi A, X, Y, Z; mpi_init( &A ); mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); TEST_ASSERT( mpi_gcd( &Z, &X, &Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); mpi_free( &A ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_cmp_int:input_X:input_A:result_CMP +/* BEGIN_CASE */ +void mpi_cmp_int( int input_X, int input_A, int result_CMP ) { mpi X; mpi_init( &X ); - TEST_ASSERT( mpi_lset( &X, {input_X} ) == 0); - TEST_ASSERT( mpi_cmp_int( &X, {input_A} ) == {result_CMP}); + TEST_ASSERT( mpi_lset( &X, input_X ) == 0); + TEST_ASSERT( mpi_cmp_int( &X, input_A ) == result_CMP); mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_cmp_mpi:radix_X:input_X:radix_Y:input_Y:input_A +/* BEGIN_CASE */ +void mpi_cmp_mpi( int radix_X, char *input_X, int radix_Y, char *input_Y, + int input_A ) { mpi X, Y; mpi_init( &X ); mpi_init( &Y ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_cmp_mpi( &X, &Y ) == {input_A} ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_cmp_mpi( &X, &Y ) == input_A ); mpi_free( &X ); mpi_free( &Y ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_cmp_abs:radix_X:input_X:radix_Y:input_Y:input_A +/* BEGIN_CASE */ +void mpi_cmp_abs( int radix_X, char *input_X, int radix_Y, char *input_Y, + int input_A ) { mpi X, Y; mpi_init( &X ); mpi_init( &Y ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_cmp_abs( &X, &Y ) == {input_A} ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_cmp_abs( &X, &Y ) == input_A ); mpi_free( &X ); mpi_free( &Y ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_copy:input_X:input_A +/* BEGIN_CASE */ +void mpi_copy( int input_X, int input_A ) { mpi X, Y, A; mpi_init( &X ); mpi_init( &Y ); mpi_init( &A ); - TEST_ASSERT( mpi_lset( &X, {input_X} ) == 0 ); - TEST_ASSERT( mpi_lset( &Y, {input_A} ) == 0 ); - TEST_ASSERT( mpi_lset( &A, {input_A} ) == 0 ); + TEST_ASSERT( mpi_lset( &X, input_X ) == 0 ); + TEST_ASSERT( mpi_lset( &Y, input_A ) == 0 ); + TEST_ASSERT( mpi_lset( &A, input_A ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &X, &Y ) != 0 ); TEST_ASSERT( mpi_cmp_mpi( &Y, &A ) == 0 ); TEST_ASSERT( mpi_copy( &Y, &X ) == 0 ); @@ -266,31 +276,31 @@ mpi_copy:input_X:input_A mpi_free( &X ); mpi_free( &Y ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_copy_self:input_X +/* BEGIN_CASE */ +void mpi_copy_self( int input_X ) { mpi X; mpi_init( &X ); - TEST_ASSERT( mpi_lset( &X, {input_X} ) == 0 ); + TEST_ASSERT( mpi_lset( &X, input_X ) == 0 ); TEST_ASSERT( mpi_copy( &X, &X ) == 0 ); - TEST_ASSERT( mpi_cmp_int( &X, {input_X} ) == 0 ); + TEST_ASSERT( mpi_cmp_int( &X, input_X ) == 0 ); mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_swap:input_X:input_Y +/* BEGIN_CASE */ +void mpi_swap( int input_X, int input_Y ) { mpi X, Y, A; mpi_init( &X ); mpi_init( &Y ); mpi_init( &A ); - TEST_ASSERT( mpi_lset( &X, {input_X} ) == 0 ); - TEST_ASSERT( mpi_lset( &Y, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_lset( &A, {input_X} ) == 0 ); + TEST_ASSERT( mpi_lset( &X, input_X ) == 0 ); + TEST_ASSERT( mpi_lset( &Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_lset( &A, input_X ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &X, &Y ) != 0 ); TEST_ASSERT( mpi_cmp_mpi( &X, &A ) == 0 ); mpi_swap( &X, &Y ); @@ -299,183 +309,200 @@ mpi_swap:input_X:input_Y mpi_free( &X ); mpi_free( &Y ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_add_mpi:radix_X:input_X:radix_Y:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_add_mpi( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A ) { mpi X, Y, Z, A; mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); TEST_ASSERT( mpi_add_mpi( &Z, &X, &Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_add_abs:radix_X:input_X:radix_Y:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_add_abs( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A ) { mpi X, Y, Z, A; mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); TEST_ASSERT( mpi_add_abs( &Z, &X, &Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_add_abs_add_first:radix_X:input_X:radix_Y:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_add_abs_add_first( int radix_X, char *input_X, int radix_Y, + char *input_Y, int radix_A, char *input_A ) { mpi X, Y, A; mpi_init( &X ); mpi_init( &Y ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); TEST_ASSERT( mpi_add_abs( &X, &X, &Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &X, &A ) == 0 ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_add_abs_add_second:radix_X:input_X:radix_Y:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_add_abs_add_second( int radix_X, char *input_X, int radix_Y, + char *input_Y, int radix_A, char *input_A ) { mpi X, Y, A; mpi_init( &X ); mpi_init( &Y ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); TEST_ASSERT( mpi_add_abs( &Y, &X, &Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &Y, &A ) == 0 ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_add_int:radix_X:input_X:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_add_int( int radix_X, char *input_X, int input_Y, int radix_A, + char *input_A ) { mpi X, Z, A; mpi_init( &X ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); - TEST_ASSERT( mpi_add_int( &Z, &X, {input_Y} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); + TEST_ASSERT( mpi_add_int( &Z, &X, input_Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); mpi_free( &X ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_sub_mpi:radix_X:input_X:radix_Y:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_sub_mpi( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A ) { mpi X, Y, Z, A; mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); TEST_ASSERT( mpi_sub_mpi( &Z, &X, &Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_sub_abs:radix_X:input_X:radix_Y:input_Y:radix_A:input_A:sub_result +/* BEGIN_CASE */ +void mpi_sub_abs( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A, int sub_result ) { mpi X, Y, Z, A; int res; mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); res = mpi_sub_abs( &Z, &X, &Y ); - TEST_ASSERT( res == {sub_result} ); + TEST_ASSERT( res == sub_result ); if( res == 0 ) TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_sub_int:radix_X:input_X:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_sub_int( int radix_X, char *input_X, int input_Y, int radix_A, + char *input_A ) { mpi X, Z, A; mpi_init( &X ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); - TEST_ASSERT( mpi_sub_int( &Z, &X, {input_Y} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); + TEST_ASSERT( mpi_sub_int( &Z, &X, input_Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); mpi_free( &X ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_mul_mpi:radix_X:input_X:radix_Y:input_Y:radix_A:input_A +/* BEGIN_CASE */ +void mpi_mul_mpi( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A ) { mpi X, Y, Z, A; mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); TEST_ASSERT( mpi_mul_mpi( &Z, &X, &Y ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_mul_int:radix_X:input_X:input_Y:radix_A:input_A:result_comparison +/* BEGIN_CASE */ +void mpi_mul_int( int radix_X, char *input_X, int input_Y, int radix_A, + char *input_A, char *result_comparison ) { mpi X, Z, A; mpi_init( &X ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); - TEST_ASSERT( mpi_mul_int( &Z, &X, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) {result_comparison} 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); + TEST_ASSERT( mpi_mul_int( &Z, &X, input_Y ) == 0 ); + if( strcmp( result_comparison, "==" ) == 0 ) + TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); + else if( strcmp( result_comparison, "!=" ) == 0 ) + TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) != 0 ); + else + TEST_ASSERT( "unknown operator" == 0 ); mpi_free( &X ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_div_mpi:radix_X:input_X:radix_Y:input_Y:radix_A:input_A:radix_B:input_B:div_result +/* BEGIN_CASE */ +void mpi_div_mpi( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A, int radix_B, char *input_B, + int div_result ) { mpi X, Y, Q, R, A, B; int res; mpi_init( &X ); mpi_init( &Y ); mpi_init( &Q ); mpi_init( &R ); mpi_init( &A ); mpi_init( &B ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); - TEST_ASSERT( mpi_read_string( &B, {radix_B}, {input_B} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); + TEST_ASSERT( mpi_read_string( &B, radix_B, input_B ) == 0 ); res = mpi_div_mpi( &Q, &R, &X, &Y ); - TEST_ASSERT( res == {div_result} ); + TEST_ASSERT( res == div_result ); if( res == 0 ) { TEST_ASSERT( mpi_cmp_mpi( &Q, &A ) == 0 ); @@ -485,21 +512,22 @@ mpi_div_mpi:radix_X:input_X:radix_Y:input_Y:radix_A:input_A:radix_B:input_B:div_ mpi_free( &X ); mpi_free( &Y ); mpi_free( &Q ); mpi_free( &R ); mpi_free( &A ); mpi_free( &B ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_div_int:radix_X:input_X:input_Y:radix_A:input_A:radix_B:input_B:div_result +/* BEGIN_CASE */ +void mpi_div_int( int radix_X, char *input_X, int input_Y, int radix_A, + char *input_A, int radix_B, char *input_B, int div_result ) { mpi X, Q, R, A, B; int res; mpi_init( &X ); mpi_init( &Q ); mpi_init( &R ); mpi_init( &A ); mpi_init( &B ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); - TEST_ASSERT( mpi_read_string( &B, {radix_B}, {input_B} ) == 0 ); - res = mpi_div_int( &Q, &R, &X, {input_Y} ); - TEST_ASSERT( res == {div_result} ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); + TEST_ASSERT( mpi_read_string( &B, radix_B, input_B ) == 0 ); + res = mpi_div_int( &Q, &R, &X, input_Y ); + TEST_ASSERT( res == div_result ); if( res == 0 ) { TEST_ASSERT( mpi_cmp_mpi( &Q, &A ) == 0 ); @@ -509,20 +537,21 @@ mpi_div_int:radix_X:input_X:input_Y:radix_A:input_A:radix_B:input_B:div_result mpi_free( &X ); mpi_free( &Q ); mpi_free( &R ); mpi_free( &A ); mpi_free( &B ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_mod_mpi:radix_X:input_X:radix_Y:input_Y:radix_A:input_A:div_result +/* BEGIN_CASE */ +void mpi_mod_mpi( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A, int div_result ) { mpi X, Y, A; int res; mpi_init( &X ); mpi_init( &Y ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); res = mpi_mod_mpi( &X, &X, &Y ); - TEST_ASSERT( res == {div_result} ); + TEST_ASSERT( res == div_result ); if( res == 0 ) { TEST_ASSERT( mpi_cmp_mpi( &X, &A ) == 0 ); @@ -530,46 +559,49 @@ mpi_mod_mpi:radix_X:input_X:radix_Y:input_Y:radix_A:input_A:div_result mpi_free( &X ); mpi_free( &Y ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_mod_int:radix_X:input_X:input_Y:input_A:div_result +/* BEGIN_CASE */ +void mpi_mod_int( int radix_X, char *input_X, int input_Y, int input_A, + int div_result ) { mpi X; int res; t_uint r; mpi_init( &X ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - res = mpi_mod_int( &r, &X, {input_Y} ); - TEST_ASSERT( res == {div_result} ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + res = mpi_mod_int( &r, &X, input_Y ); + TEST_ASSERT( res == div_result ); if( res == 0 ) { - TEST_ASSERT( r == {input_A} ); + TEST_ASSERT( r == (t_uint) input_A ); } mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_exp_mod:radix_A:input_A:radix_E:input_E:radix_N:input_N:radix_RR:input_RR:radix_X:input_X:div_result +/* BEGIN_CASE */ +void mpi_exp_mod( int radix_A, char *input_A, int radix_E, char *input_E, + int radix_N, char *input_N, int radix_RR, char *input_RR, + int radix_X, char *input_X, int div_result ) { mpi A, E, N, RR, Z, X; int res; mpi_init( &A ); mpi_init( &E ); mpi_init( &N ); mpi_init( &RR ); mpi_init( &Z ); mpi_init( &X ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); - TEST_ASSERT( mpi_read_string( &E, {radix_E}, {input_E} ) == 0 ); - TEST_ASSERT( mpi_read_string( &N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); + TEST_ASSERT( mpi_read_string( &E, radix_E, input_E ) == 0 ); + TEST_ASSERT( mpi_read_string( &N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); - if( strlen( {input_RR} ) ) - TEST_ASSERT( mpi_read_string( &RR, {radix_RR}, {input_RR} ) == 0 ); + if( strlen( input_RR ) ) + TEST_ASSERT( mpi_read_string( &RR, radix_RR, input_RR ) == 0 ); res = mpi_exp_mod( &Z, &A, &E, &N, &RR ); - TEST_ASSERT( res == {div_result} ); + TEST_ASSERT( res == div_result ); if( res == 0 ) { TEST_ASSERT( mpi_cmp_mpi( &Z, &X ) == 0 ); @@ -578,20 +610,21 @@ mpi_exp_mod:radix_A:input_A:radix_E:input_E:radix_N:input_N:radix_RR:input_RR:ra mpi_free( &A ); mpi_free( &E ); mpi_free( &N ); mpi_free( &RR ); mpi_free( &Z ); mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_inv_mod:radix_X:input_X:radix_Y:input_Y:radix_A:input_A:div_result +/* BEGIN_CASE */ +void mpi_inv_mod( int radix_X, char *input_X, int radix_Y, char *input_Y, + int radix_A, char *input_A, int div_result ) { mpi X, Y, Z, A; int res; mpi_init( &X ); mpi_init( &Y ); mpi_init( &Z ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &Y, {radix_Y}, {input_Y} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &Y, radix_Y, input_Y ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); res = mpi_inv_mod( &Z, &X, &Y ); - TEST_ASSERT( res == {div_result} ); + TEST_ASSERT( res == div_result ); if( res == 0 ) { TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); @@ -599,63 +632,58 @@ mpi_inv_mod:radix_X:input_X:radix_Y:input_Y:radix_A:input_A:div_result mpi_free( &X ); mpi_free( &Y ); mpi_free( &Z ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_is_prime:radix_X:input_X:div_result +/* BEGIN_CASE */ +void mpi_is_prime( int radix_X, char *input_X, int div_result ) { mpi X; int res; mpi_init( &X ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); res = mpi_is_prime( &X, rnd_std_rand, NULL ); - TEST_ASSERT( res == {div_result} ); + TEST_ASSERT( res == div_result ); mpi_free( &X ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_shift_l:radix_X:input_X:shift_X:radix_A:input_A +/* BEGIN_CASE */ +void mpi_shift_l( int radix_X, char *input_X, int shift_X, int radix_A, + char *input_A) { mpi X, A; mpi_init( &X ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); - TEST_ASSERT( mpi_shift_l( &X, {shift_X} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); + TEST_ASSERT( mpi_shift_l( &X, shift_X ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &X, &A ) == 0 ); mpi_free( &X ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_shift_r:radix_X:input_X:shift_X:radix_A:input_A +/* BEGIN_CASE */ +void mpi_shift_r( int radix_X, char *input_X, int shift_X, int radix_A, + char *input_A ) { mpi X, A; mpi_init( &X ); mpi_init( &A ); - TEST_ASSERT( mpi_read_string( &X, {radix_X}, {input_X} ) == 0 ); - TEST_ASSERT( mpi_read_string( &A, {radix_A}, {input_A} ) == 0 ); - TEST_ASSERT( mpi_shift_r( &X, {shift_X} ) == 0 ); + TEST_ASSERT( mpi_read_string( &X, radix_X, input_X ) == 0 ); + TEST_ASSERT( mpi_read_string( &A, radix_A, input_A ) == 0 ); + TEST_ASSERT( mpi_shift_r( &X, shift_X ) == 0 ); TEST_ASSERT( mpi_cmp_mpi( &X, &A ) == 0 ); mpi_free( &X ); mpi_free( &A ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -mpi_selftest: +/* BEGIN_CASE */ +void mpi_selftest() { TEST_ASSERT( mpi_self_test( 0 ) == 0 ); } -END_CASE -/* Helper Code - char str[1000]; - int len = 1000; - mpi_write_string(&Z, 10, str, &len); - printf("Z: %d %s\n", Z.s, str); - TEST_ASSERT( mpi_cmp_mpi( &Z, &A ) == 0 ); -*/ +/* END_CASE */ diff --git a/tests/suites/test_suite_pbkdf2.data b/tests/suites/test_suite_pbkdf2.data index 1ac2be782..7ee036006 100644 --- a/tests/suites/test_suite_pbkdf2.data +++ b/tests/suites/test_suite_pbkdf2.data @@ -1,14 +1,19 @@ PBKDF2 RFC 6070 Test Vector #1 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"70617373776f7264":"73616c74":1:20:"0c60c80f961f0e71f3a9b524af6012062fe037a6" PBKDF2 RFC 6070 Test Vector #2 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"70617373776f7264":"73616c74":2:20:"ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" PBKDF2 RFC 6070 Test Vector #3 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"70617373776f7264":"73616c74":4096:20:"4b007901b765489abead49d926f721d065a429c1" PBKDF2 RFC 6070 Test Vector #5 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"70617373776f726450415353574f524470617373776f7264":"73616c7453414c5473616c7453414c5473616c7453414c5473616c7453414c5473616c74":4096:25:"3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" PBKDF2 RFC 6070 Test Vector #6 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"7061737300776f7264":"7361006c74":4096:16:"56fa6aa75548099dcc37d7f03425e0c3" diff --git a/tests/suites/test_suite_pbkdf2.function b/tests/suites/test_suite_pbkdf2.function index 79d111955..bd52bf91e 100644 --- a/tests/suites/test_suite_pbkdf2.function +++ b/tests/suites/test_suite_pbkdf2.function @@ -1,13 +1,15 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_PBKDF2_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_PBKDF2_C + * END_DEPENDENCIES + */ -BEGIN_CASE -pbkdf2_hmac:hash:hex_password_string:hex_salt_string:it_cnt:key_len:result_key_string +/* BEGIN_CASE */ +void pbkdf2_hmac( int hash, char *hex_password_string, char *hex_salt_string, + int it_cnt, int key_len, char *result_key_string ) { unsigned char pw_str[100]; unsigned char salt_str[100]; @@ -23,18 +25,20 @@ pbkdf2_hmac:hash:hex_password_string:hex_salt_string:it_cnt:key_len:result_key_s memset(salt_str, 0x00, 100); memset(dst_str, 0x00, 100); - pw_len = unhexify( pw_str, {hex_password_string} ); - salt_len = unhexify( salt_str, {hex_salt_string} ); + pw_len = unhexify( pw_str, hex_password_string ); + salt_len = unhexify( salt_str, hex_salt_string ); - info = md_info_from_type( {hash} ); + info = md_info_from_type( hash ); TEST_ASSERT( info != NULL ); + if( info == NULL ) + return; TEST_ASSERT( md_init_ctx( &ctx, info ) == 0 ); TEST_ASSERT( pbkdf2_hmac( &ctx, pw_str, pw_len, salt_str, salt_len, - {it_cnt}, {key_len}, key ) == 0 ); + it_cnt, key_len, key ) == 0 ); TEST_ASSERT( md_free_ctx( &ctx ) == 0 ); - hexify( dst_str, key, {key_len} ); - TEST_ASSERT( strcmp( (char *) dst_str, {result_key_string} ) == 0 ); + hexify( dst_str, key, key_len ); + TEST_ASSERT( strcmp( (char *) dst_str, result_key_string ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_pkcs1_v21.function b/tests/suites/test_suite_pkcs1_v21.function index 57dd3415a..21ef421be 100644 --- a/tests/suites/test_suite_pkcs1_v21.function +++ b/tests/suites/test_suite_pkcs1_v21.function @@ -1,4 +1,4 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include #include #include @@ -7,14 +7,18 @@ BEGIN_HEADER #include #include #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_PKCS1_V21:POLARSSL_RSA_C:POLARSSL_BIGNUM_C:POLARSSL_SHA1_C:POLARSSL_GENPRIME -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_PKCS1_V21:POLARSSL_RSA_C:POLARSSL_BIGNUM_C:POLARSSL_SHA1_C:POLARSSL_GENPRIME + * END_DEPENDENCIES + */ -BEGIN_CASE -pkcs1_rsaes_oaep_encrypt:mod:radix_N:input_N:radix_E:input_E:hash:message_hex_string:seed:result_hex_str:result +/* BEGIN_CASE */ +void pkcs1_rsaes_oaep_encrypt( int mod, int radix_N, char *input_N, int radix_E, + char *input_E, int hash, + char *message_hex_string, char *seed, + char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char output[1000]; @@ -24,36 +28,40 @@ pkcs1_rsaes_oaep_encrypt:mod:radix_N:input_N:radix_E:input_E:hash:message_hex_st size_t msg_len; rnd_buf_info info; - info.length = unhexify( rnd_buf, {seed} ); + info.length = unhexify( rnd_buf, seed ); info.buf = rnd_buf; - rsa_init( &ctx, RSA_PKCS_V21, {hash} ); + rsa_init( &ctx, RSA_PKCS_V21, hash ); memset( message_str, 0x00, 1000 ); memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8 + ( ( {mod} % 8 ) ? 1 : 0 ); - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 ); - msg_len = unhexify( message_str, {message_hex_string} ); + msg_len = unhexify( message_str, message_hex_string ); - TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, &rnd_buffer_rand, &info, RSA_PUBLIC, msg_len, message_str, output ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, &rnd_buffer_rand, &info, RSA_PUBLIC, msg_len, message_str, output ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len ); - TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 ); } rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -pkcs1_rsaes_oaep_decrypt:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:input_E:hash:result_hex_str:seed:message_hex_string:result +/* BEGIN_CASE */ +void pkcs1_rsaes_oaep_decrypt( int mod, int radix_P, char *input_P, + int radix_Q, char *input_Q, int radix_N, + char *input_N, int radix_E, char *input_E, + int hash, char *result_hex_str, char *seed, + char *message_hex_string, int result ) { unsigned char message_str[1000]; unsigned char output[1000]; @@ -61,19 +69,20 @@ pkcs1_rsaes_oaep_decrypt:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:rad rsa_context ctx; mpi P1, Q1, H, G; size_t output_len; + ((void) seed); mpi_init( &P1 ); mpi_init( &Q1 ); mpi_init( &H ); mpi_init( &G ); - rsa_init( &ctx, RSA_PKCS_V21, {hash} ); + rsa_init( &ctx, RSA_PKCS_V21, hash ); memset( message_str, 0x00, 1000 ); memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8 + ( ( {mod} % 8 ) ? 1 : 0 ); - TEST_ASSERT( mpi_read_string( &ctx.P, {radix_P}, {input_P} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.Q, {radix_Q}, {input_Q} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 ); + TEST_ASSERT( mpi_read_string( &ctx.P, radix_P, input_P ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( mpi_sub_int( &P1, &ctx.P, 1 ) == 0 ); TEST_ASSERT( mpi_sub_int( &Q1, &ctx.Q, 1 ) == 0 ); @@ -86,23 +95,27 @@ pkcs1_rsaes_oaep_decrypt:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:rad TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 ); - unhexify( message_str, {message_hex_string} ); + unhexify( message_str, message_hex_string ); - TEST_ASSERT( rsa_pkcs1_decrypt( &ctx, RSA_PRIVATE, &output_len, message_str, output, 1000 ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_pkcs1_decrypt( &ctx, RSA_PRIVATE, &output_len, message_str, output, 1000 ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len ); - TEST_ASSERT( strncasecmp( (char *) output_str, {result_hex_str}, strlen( {result_hex_str} ) ) == 0 ); + TEST_ASSERT( strncasecmp( (char *) output_str, result_hex_str, strlen( result_hex_str ) ) == 0 ); } mpi_free( &P1 ); mpi_free( &Q1 ); mpi_free( &H ); mpi_free( &G ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -pkcs1_rsassa_pss_sign:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:input_E:digest:hash:message_hex_string:salt:result_hex_str:result +/* BEGIN_CASE */ +void pkcs1_rsassa_pss_sign( int mod, int radix_P, char *input_P, int radix_Q, + char *input_Q, int radix_N, char *input_N, + int radix_E, char *input_E, int digest, int hash, + char *message_hex_string, char *salt, + char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char hash_result[1000]; @@ -114,22 +127,22 @@ pkcs1_rsassa_pss_sign:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_ size_t msg_len; rnd_buf_info info; - info.length = unhexify( rnd_buf, {salt} ); + info.length = unhexify( rnd_buf, salt ); info.buf = rnd_buf; mpi_init( &P1 ); mpi_init( &Q1 ); mpi_init( &H ); mpi_init( &G ); - rsa_init( &ctx, RSA_PKCS_V21, {hash} ); + rsa_init( &ctx, RSA_PKCS_V21, hash ); memset( message_str, 0x00, 1000 ); memset( hash_result, 0x00, 1000 ); memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8 + ( ( {mod} % 8 ) ? 1 : 0 ); - TEST_ASSERT( mpi_read_string( &ctx.P, {radix_P}, {input_P} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.Q, {radix_Q}, {input_Q} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 ); + TEST_ASSERT( mpi_read_string( &ctx.P, radix_P, input_P ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( mpi_sub_int( &P1, &ctx.P, 1 ) == 0 ); TEST_ASSERT( mpi_sub_int( &Q1, &ctx.Q, 1 ) == 0 ); @@ -142,52 +155,56 @@ pkcs1_rsassa_pss_sign:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_ TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 ); - msg_len = unhexify( message_str, {message_hex_string} ); + msg_len = unhexify( message_str, message_hex_string ); - if( md_info_from_type( {digest} ) != NULL ) - TEST_ASSERT( md( md_info_from_type( {digest} ), message_str, msg_len, hash_result ) == 0 ); + if( md_info_from_type( digest ) != NULL ) + TEST_ASSERT( md( md_info_from_type( digest ), message_str, msg_len, hash_result ) == 0 ); - TEST_ASSERT( rsa_pkcs1_sign( &ctx, &rnd_buffer_rand, &info, RSA_PRIVATE, {digest}, 0, hash_result, output ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_pkcs1_sign( &ctx, &rnd_buffer_rand, &info, RSA_PRIVATE, digest, 0, hash_result, output ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len); - TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 ); } mpi_free( &P1 ); mpi_free( &Q1 ); mpi_free( &H ); mpi_free( &G ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -pkcs1_rsassa_pss_verify:mod:radix_N:input_N:radix_E:input_E:digest:hash:message_hex_string:salt:result_hex_str:result +/* BEGIN_CASE */ +void pkcs1_rsassa_pss_verify( int mod, int radix_N, char *input_N, int radix_E, + char *input_E, int digest, int hash, + char *message_hex_string, char *salt, + char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char hash_result[1000]; unsigned char result_str[1000]; rsa_context ctx; size_t msg_len; + ((void) salt); - rsa_init( &ctx, RSA_PKCS_V21, {hash} ); + rsa_init( &ctx, RSA_PKCS_V21, hash ); memset( message_str, 0x00, 1000 ); memset( hash_result, 0x00, 1000 ); memset( result_str, 0x00, 1000 ); - ctx.len = {mod} / 8 + ( ( {mod} % 8 ) ? 1 : 0 ); - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 ); - msg_len = unhexify( message_str, {message_hex_string} ); - unhexify( result_str, {result_hex_str} ); + msg_len = unhexify( message_str, message_hex_string ); + unhexify( result_str, result_hex_str ); - if( md_info_from_type( {digest} ) != NULL ) - TEST_ASSERT( md( md_info_from_type( {digest} ), message_str, msg_len, hash_result ) == 0 ); + if( md_info_from_type( digest ) != NULL ) + TEST_ASSERT( md( md_info_from_type( digest ), message_str, msg_len, hash_result ) == 0 ); - TEST_ASSERT( rsa_pkcs1_verify( &ctx, RSA_PUBLIC, {digest}, 0, hash_result, result_str ) == {result} ); + TEST_ASSERT( rsa_pkcs1_verify( &ctx, RSA_PUBLIC, digest, 0, hash_result, result_str ) == result ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_pkcs5.data b/tests/suites/test_suite_pkcs5.data index 1ac2be782..7ee036006 100644 --- a/tests/suites/test_suite_pkcs5.data +++ b/tests/suites/test_suite_pkcs5.data @@ -1,14 +1,19 @@ PBKDF2 RFC 6070 Test Vector #1 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"70617373776f7264":"73616c74":1:20:"0c60c80f961f0e71f3a9b524af6012062fe037a6" PBKDF2 RFC 6070 Test Vector #2 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"70617373776f7264":"73616c74":2:20:"ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957" PBKDF2 RFC 6070 Test Vector #3 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"70617373776f7264":"73616c74":4096:20:"4b007901b765489abead49d926f721d065a429c1" PBKDF2 RFC 6070 Test Vector #5 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"70617373776f726450415353574f524470617373776f7264":"73616c7453414c5473616c7453414c5473616c7453414c5473616c7453414c5473616c74":4096:25:"3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038" PBKDF2 RFC 6070 Test Vector #6 (SHA1) +depends_on:POLARSSL_SHA1_C pbkdf2_hmac:POLARSSL_MD_SHA1:"7061737300776f7264":"7361006c74":4096:16:"56fa6aa75548099dcc37d7f03425e0c3" diff --git a/tests/suites/test_suite_pkcs5.function b/tests/suites/test_suite_pkcs5.function index ae546624f..adf7ffc70 100644 --- a/tests/suites/test_suite_pkcs5.function +++ b/tests/suites/test_suite_pkcs5.function @@ -1,13 +1,16 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_PKCS5_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_PKCS5_C + * END_DEPENDENCIES + */ -BEGIN_CASE -pbkdf2_hmac:hash:hex_password_string:hex_salt_string:it_cnt:key_len:result_key_string +/* BEGIN_CASE */ +void pbkdf2_hmac( int hash, char *hex_password_string, + char *hex_salt_string, int it_cnt, int key_len, + char *result_key_string ) { unsigned char pw_str[100]; unsigned char salt_str[100]; @@ -23,18 +26,20 @@ pbkdf2_hmac:hash:hex_password_string:hex_salt_string:it_cnt:key_len:result_key_s memset(salt_str, 0x00, 100); memset(dst_str, 0x00, 100); - pw_len = unhexify( pw_str, {hex_password_string} ); - salt_len = unhexify( salt_str, {hex_salt_string} ); + pw_len = unhexify( pw_str, hex_password_string ); + salt_len = unhexify( salt_str, hex_salt_string ); - info = md_info_from_type( {hash} ); + info = md_info_from_type( hash ); TEST_ASSERT( info != NULL ); + if( info == NULL ) + return; TEST_ASSERT( md_init_ctx( &ctx, info ) == 0 ); TEST_ASSERT( pkcs5_pbkdf2_hmac( &ctx, pw_str, pw_len, salt_str, salt_len, - {it_cnt}, {key_len}, key ) == 0 ); + it_cnt, key_len, key ) == 0 ); TEST_ASSERT( md_free_ctx( &ctx ) == 0 ); - hexify( dst_str, key, {key_len} ); - TEST_ASSERT( strcmp( (char *) dst_str, {result_key_string} ) == 0 ); + hexify( dst_str, key, key_len ); + TEST_ASSERT( strcmp( (char *) dst_str, result_key_string ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_rsa.function b/tests/suites/test_suite_rsa.function index 848ef7607..af26264d0 100644 --- a/tests/suites/test_suite_rsa.function +++ b/tests/suites/test_suite_rsa.function @@ -1,4 +1,4 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include #include #include @@ -8,14 +8,18 @@ BEGIN_HEADER #include #include #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_RSA_C:POLARSSL_BIGNUM_C:POLARSSL_GENPRIME -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_RSA_C:POLARSSL_BIGNUM_C:POLARSSL_GENPRIME + * END_DEPENDENCIES + */ -BEGIN_CASE -rsa_pkcs1_sign:message_hex_string:padding_mode:digest:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:input_E:result_hex_str:result +/* BEGIN_CASE */ +void rsa_pkcs1_sign( char *message_hex_string, int padding_mode, int digest, + int mod, int radix_P, char *input_P, int radix_Q, + char *input_Q, int radix_N, char *input_N, int radix_E, + char *input_E, char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char hash_result[1000]; @@ -26,18 +30,18 @@ rsa_pkcs1_sign:message_hex_string:padding_mode:digest:mod:radix_P:input_P:radix_ int msg_len; mpi_init( &P1 ); mpi_init( &Q1 ); mpi_init( &H ); mpi_init( &G ); - rsa_init( &ctx, {padding_mode}, 0 ); + rsa_init( &ctx, padding_mode, 0 ); memset( message_str, 0x00, 1000 ); memset( hash_result, 0x00, 1000 ); memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.P, {radix_P}, {input_P} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.Q, {radix_Q}, {input_Q} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.P, radix_P, input_P ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( mpi_sub_int( &P1, &ctx.P, 1 ) == 0 ); TEST_ASSERT( mpi_sub_int( &Q1, &ctx.Q, 1 ) == 0 ); @@ -50,26 +54,28 @@ rsa_pkcs1_sign:message_hex_string:padding_mode:digest:mod:radix_P:input_P:radix_ TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 ); - msg_len = unhexify( message_str, {message_hex_string} ); + msg_len = unhexify( message_str, message_hex_string ); - if( md_info_from_type( {digest} ) != NULL ) - TEST_ASSERT( md( md_info_from_type( {digest} ), message_str, msg_len, hash_result ) == 0 ); + if( md_info_from_type( digest ) != NULL ) + TEST_ASSERT( md( md_info_from_type( digest ), message_str, msg_len, hash_result ) == 0 ); - TEST_ASSERT( rsa_pkcs1_sign( &ctx, NULL, NULL, RSA_PRIVATE, {digest}, 0, hash_result, output ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_pkcs1_sign( &ctx, NULL, NULL, RSA_PRIVATE, digest, 0, hash_result, output ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len ); - TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 ); } mpi_free( &P1 ); mpi_free( &Q1 ); mpi_free( &H ); mpi_free( &G ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_pkcs1_verify:message_hex_string:padding_mode:digest:mod:radix_N:input_N:radix_E:input_E:result_hex_str:result +/* BEGIN_CASE */ +void rsa_pkcs1_verify( char *message_hex_string, int padding_mode, int digest, + int mod, int radix_N, char *input_N, int radix_E, + char *input_E, char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char hash_result[1000]; @@ -77,32 +83,36 @@ rsa_pkcs1_verify:message_hex_string:padding_mode:digest:mod:radix_N:input_N:radi rsa_context ctx; int msg_len; - rsa_init( &ctx, {padding_mode}, 0 ); + rsa_init( &ctx, padding_mode, 0 ); memset( message_str, 0x00, 1000 ); memset( hash_result, 0x00, 1000 ); memset( result_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 ); - msg_len = unhexify( message_str, {message_hex_string} ); - unhexify( result_str, {result_hex_str} ); + msg_len = unhexify( message_str, message_hex_string ); + unhexify( result_str, result_hex_str ); - if( md_info_from_type( {digest} ) != NULL ) - TEST_ASSERT( md( md_info_from_type( {digest} ), message_str, msg_len, hash_result ) == 0 ); + if( md_info_from_type( digest ) != NULL ) + TEST_ASSERT( md( md_info_from_type( digest ), message_str, msg_len, hash_result ) == 0 ); - TEST_ASSERT( rsa_pkcs1_verify( &ctx, RSA_PUBLIC, {digest}, 0, hash_result, result_str ) == {result} ); + TEST_ASSERT( rsa_pkcs1_verify( &ctx, RSA_PUBLIC, digest, 0, hash_result, result_str ) == result ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_pkcs1_sign_raw:message_hex_string:hash_result_string:padding_mode:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:input_E:result_hex_str +/* BEGIN_CASE */ +void rsa_pkcs1_sign_raw( char *message_hex_string, char *hash_result_string, + int padding_mode, int mod, int radix_P, char *input_P, + int radix_Q, char *input_Q, int radix_N, + char *input_N, int radix_E, char *input_E, + char *result_hex_str ) { unsigned char message_str[1000]; unsigned char hash_result[1000]; @@ -113,18 +123,18 @@ rsa_pkcs1_sign_raw:message_hex_string:hash_result_string:padding_mode:mod:radix_ int hash_len; mpi_init( &P1 ); mpi_init( &Q1 ); mpi_init( &H ); mpi_init( &G ); - rsa_init( &ctx, {padding_mode}, 0 ); + rsa_init( &ctx, padding_mode, 0 ); memset( message_str, 0x00, 1000 ); memset( hash_result, 0x00, 1000 ); memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.P, {radix_P}, {input_P} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.Q, {radix_Q}, {input_Q} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.P, radix_P, input_P ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( mpi_sub_int( &P1, &ctx.P, 1 ) == 0 ); TEST_ASSERT( mpi_sub_int( &Q1, &ctx.Q, 1 ) == 0 ); @@ -137,22 +147,25 @@ rsa_pkcs1_sign_raw:message_hex_string:hash_result_string:padding_mode:mod:radix_ TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 ); - unhexify( message_str, {message_hex_string} ); - hash_len = unhexify( hash_result, {hash_result_string} ); + unhexify( message_str, message_hex_string ); + hash_len = unhexify( hash_result, hash_result_string ); TEST_ASSERT( rsa_pkcs1_sign( &ctx, NULL, NULL, RSA_PRIVATE, POLARSSL_MD_NONE, hash_len, hash_result, output ) == 0 ); hexify( output_str, output, ctx.len ); - TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 ); mpi_free( &P1 ); mpi_free( &Q1 ); mpi_free( &H ); mpi_free( &G ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_pkcs1_verify_raw:message_hex_string:hash_result_string:padding_mode:mod:radix_N:input_N:radix_E:input_E:result_hex_str:correct +/* BEGIN_CASE */ +void rsa_pkcs1_verify_raw( char *message_hex_string, char *hash_result_string, + int padding_mode, int mod, int radix_N, + char *input_N, int radix_E, char *input_E, + char *result_hex_str, int correct ) { unsigned char message_str[1000]; unsigned char hash_result[1000]; @@ -160,29 +173,31 @@ rsa_pkcs1_verify_raw:message_hex_string:hash_result_string:padding_mode:mod:radi rsa_context ctx; size_t hash_len; - rsa_init( &ctx, {padding_mode}, 0 ); + rsa_init( &ctx, padding_mode, 0 ); memset( message_str, 0x00, 1000 ); memset( hash_result, 0x00, 1000 ); memset( result_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 ); - unhexify( message_str, {message_hex_string} ); - hash_len = unhexify( hash_result, {hash_result_string} ); - unhexify( result_str, {result_hex_str} ); + unhexify( message_str, message_hex_string ); + hash_len = unhexify( hash_result, hash_result_string ); + unhexify( result_str, result_hex_str ); - TEST_ASSERT( rsa_pkcs1_verify( &ctx, RSA_PUBLIC, POLARSSL_MD_NONE, hash_len, hash_result, result_str ) == {correct} ); + TEST_ASSERT( rsa_pkcs1_verify( &ctx, RSA_PUBLIC, POLARSSL_MD_NONE, hash_len, hash_result, result_str ) == correct ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_pkcs1_encrypt:message_hex_string:padding_mode:mod:radix_N:input_N:radix_E:input_E:result_hex_str:result +/* BEGIN_CASE */ +void rsa_pkcs1_encrypt( char *message_hex_string, int padding_mode, int mod, + int radix_N, char *input_N, int radix_E, char *input_E, + char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char output[1000]; @@ -193,33 +208,36 @@ rsa_pkcs1_encrypt:message_hex_string:padding_mode:mod:radix_N:input_N:radix_E:in memset( &rnd_info, 0, sizeof( rnd_pseudo_info ) ); - rsa_init( &ctx, {padding_mode}, 0 ); + rsa_init( &ctx, padding_mode, 0 ); memset( message_str, 0x00, 1000 ); memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 ); - msg_len = unhexify( message_str, {message_hex_string} ); + msg_len = unhexify( message_str, message_hex_string ); - TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, &rnd_pseudo_rand, &rnd_info, RSA_PUBLIC, msg_len, message_str, output ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, &rnd_pseudo_rand, &rnd_info, RSA_PUBLIC, msg_len, message_str, output ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len ); - TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 ); } rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_pkcs1_encrypt_bad_rng:message_hex_string:padding_mode:mod:radix_N:input_N:radix_E:input_E:result_hex_str:result +/* BEGIN_CASE */ +void rsa_pkcs1_encrypt_bad_rng( char *message_hex_string, int padding_mode, + int mod, int radix_N, char *input_N, + int radix_E, char *input_E, + char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char output[1000]; @@ -227,33 +245,36 @@ rsa_pkcs1_encrypt_bad_rng:message_hex_string:padding_mode:mod:radix_N:input_N:ra rsa_context ctx; size_t msg_len; - rsa_init( &ctx, {padding_mode}, 0 ); + rsa_init( &ctx, padding_mode, 0 ); memset( message_str, 0x00, 1000 ); memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 ); - msg_len = unhexify( message_str, {message_hex_string} ); + msg_len = unhexify( message_str, message_hex_string ); - TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, &rnd_zero_rand, NULL, RSA_PUBLIC, msg_len, message_str, output ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_pkcs1_encrypt( &ctx, &rnd_zero_rand, NULL, RSA_PUBLIC, msg_len, message_str, output ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len ); - TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 ); } rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_pkcs1_decrypt:message_hex_string:padding_mode:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:input_E:max_output:result_hex_str:result +/* BEGIN_CASE */ +void rsa_pkcs1_decrypt( char *message_hex_string, int padding_mode, int mod, + int radix_P, char *input_P, int radix_Q, char *input_Q, + int radix_N, char *input_N, int radix_E, char *input_E, + int max_output, char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char output[1000]; @@ -263,17 +284,17 @@ rsa_pkcs1_decrypt:message_hex_string:padding_mode:mod:radix_P:input_P:radix_Q:in size_t output_len; mpi_init( &P1 ); mpi_init( &Q1 ); mpi_init( &H ); mpi_init( &G ); - rsa_init( &ctx, {padding_mode}, 0 ); + rsa_init( &ctx, padding_mode, 0 ); memset( message_str, 0x00, 1000 ); memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.P, {radix_P}, {input_P} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.Q, {radix_Q}, {input_Q} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.P, radix_P, input_P ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( mpi_sub_int( &P1, &ctx.P, 1 ) == 0 ); TEST_ASSERT( mpi_sub_int( &Q1, &ctx.Q, 1 ) == 0 ); @@ -286,24 +307,25 @@ rsa_pkcs1_decrypt:message_hex_string:padding_mode:mod:radix_P:input_P:radix_Q:in TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 ); - unhexify( message_str, {message_hex_string} ); + unhexify( message_str, message_hex_string ); output_len = 0; - TEST_ASSERT( rsa_pkcs1_decrypt( &ctx, RSA_PRIVATE, &output_len, message_str, output, {max_output} ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_pkcs1_decrypt( &ctx, RSA_PRIVATE, &output_len, message_str, output, max_output ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len ); - TEST_ASSERT( strncasecmp( (char *) output_str, {result_hex_str}, strlen( {result_hex_str} ) ) == 0 ); + TEST_ASSERT( strncasecmp( (char *) output_str, result_hex_str, strlen( result_hex_str ) ) == 0 ); } mpi_free( &P1 ); mpi_free( &Q1 ); mpi_free( &H ); mpi_free( &G ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_public:message_hex_string:mod:radix_N:input_N:radix_E:input_E:result_hex_str:result +/* BEGIN_CASE */ +void rsa_public( char *message_hex_string, int mod, int radix_N, char *input_N, + int radix_E, char *input_E, char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char output[1000]; @@ -315,28 +337,30 @@ rsa_public:message_hex_string:mod:radix_N:input_N:radix_E:input_E:result_hex_str memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 ); - unhexify( message_str, {message_hex_string} ); + unhexify( message_str, message_hex_string ); - TEST_ASSERT( rsa_public( &ctx, message_str, output ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_public( &ctx, message_str, output ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len ); - TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 ); } rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_private:message_hex_string:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:input_E:result_hex_str:result +/* BEGIN_CASE */ +void rsa_private( char *message_hex_string, int mod, int radix_P, char *input_P, + int radix_Q, char *input_Q, int radix_N, char *input_N, + int radix_E, char *input_E, char *result_hex_str, int result ) { unsigned char message_str[1000]; unsigned char output[1000]; @@ -351,11 +375,11 @@ rsa_private:message_hex_string:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input memset( output, 0x00, 1000 ); memset( output_str, 0x00, 1000 ); - ctx.len = {mod} / 8; - TEST_ASSERT( mpi_read_string( &ctx.P, {radix_P}, {input_P} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.Q, {radix_Q}, {input_Q} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + ctx.len = mod / 8; + TEST_ASSERT( mpi_read_string( &ctx.P, radix_P, input_P ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); TEST_ASSERT( mpi_sub_int( &P1, &ctx.P, 1 ) == 0 ); TEST_ASSERT( mpi_sub_int( &Q1, &ctx.Q, 1 ) == 0 ); @@ -368,102 +392,108 @@ rsa_private:message_hex_string:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 ); - unhexify( message_str, {message_hex_string} ); + unhexify( message_str, message_hex_string ); - TEST_ASSERT( rsa_private( &ctx, message_str, output ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_private( &ctx, message_str, output ) == result ); + if( result == 0 ) { hexify( output_str, output, ctx.len ); - TEST_ASSERT( strcasecmp( (char *) output_str, {result_hex_str} ) == 0 ); + TEST_ASSERT( strcasecmp( (char *) output_str, result_hex_str ) == 0 ); } mpi_free( &P1 ); mpi_free( &Q1 ); mpi_free( &H ); mpi_free( &G ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_check_privkey_null: +/* BEGIN_CASE */ +void rsa_check_privkey_null() { rsa_context ctx; memset( &ctx, 0x00, sizeof( rsa_context ) ); TEST_ASSERT( rsa_check_privkey( &ctx ) == POLARSSL_ERR_RSA_KEY_CHECK_FAILED ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_check_pubkey:radix_N:input_N:radix_E:input_E:result +/* BEGIN_CASE */ +void rsa_check_pubkey( int radix_N, char *input_N, int radix_E, char *input_E, + int result ) { rsa_context ctx; rsa_init( &ctx, RSA_PKCS_V15, 0 ); - if( strlen( {input_N} ) ) + if( strlen( input_N ) ) { - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); } - if( strlen( {input_E} ) ) + if( strlen( input_E ) ) { - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); } - TEST_ASSERT( rsa_check_pubkey( &ctx ) == {result} ); + TEST_ASSERT( rsa_check_pubkey( &ctx ) == result ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_check_privkey:mod:radix_P:input_P:radix_Q:input_Q:radix_N:input_N:radix_E:input_E:radix_D:input_D:radix_DP:input_DP:radix_DQ:input_DQ:radix_QP:input_QP:result +/* BEGIN_CASE */ +void rsa_check_privkey( int mod, int radix_P, char *input_P, int radix_Q, + char *input_Q, int radix_N, char *input_N, + int radix_E, char *input_E, int radix_D, char *input_D, + int radix_DP, char *input_DP, int radix_DQ, + char *input_DQ, int radix_QP, char *input_QP, + int result ) { rsa_context ctx; rsa_init( &ctx, RSA_PKCS_V15, 0 ); - ctx.len = {mod} / 8; - if( strlen( {input_P} ) ) + ctx.len = mod / 8; + if( strlen( input_P ) ) { - TEST_ASSERT( mpi_read_string( &ctx.P, {radix_P}, {input_P} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.P, radix_P, input_P ) == 0 ); } - if( strlen( {input_Q} ) ) + if( strlen( input_Q ) ) { - TEST_ASSERT( mpi_read_string( &ctx.Q, {radix_Q}, {input_Q} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 ); } - if( strlen( {input_N} ) ) + if( strlen( input_N ) ) { - TEST_ASSERT( mpi_read_string( &ctx.N, {radix_N}, {input_N} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 ); } - if( strlen( {input_E} ) ) + if( strlen( input_E ) ) { - TEST_ASSERT( mpi_read_string( &ctx.E, {radix_E}, {input_E} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 ); } - if( strlen( {input_D} ) ) + if( strlen( input_D ) ) { - TEST_ASSERT( mpi_read_string( &ctx.D, {radix_D}, {input_D} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.D, radix_D, input_D ) == 0 ); } - if( strlen( {input_DP} ) ) + if( strlen( input_DP ) ) { - TEST_ASSERT( mpi_read_string( &ctx.DP, {radix_DP}, {input_DP} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.DP, radix_DP, input_DP ) == 0 ); } - if( strlen( {input_DQ} ) ) + if( strlen( input_DQ ) ) { - TEST_ASSERT( mpi_read_string( &ctx.DQ, {radix_DQ}, {input_DQ} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.DQ, radix_DQ, input_DQ ) == 0 ); } - if( strlen( {input_QP} ) ) + if( strlen( input_QP ) ) { - TEST_ASSERT( mpi_read_string( &ctx.QP, {radix_QP}, {input_QP} ) == 0 ); + TEST_ASSERT( mpi_read_string( &ctx.QP, radix_QP, input_QP ) == 0 ); } - TEST_ASSERT( rsa_check_privkey( &ctx ) == {result} ); + TEST_ASSERT( rsa_check_privkey( &ctx ) == result ); rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_gen_key:nrbits:exponent:result +/* BEGIN_CASE */ +void rsa_gen_key( int nrbits, int exponent, int result) { rsa_context ctx; entropy_context entropy; @@ -476,19 +506,19 @@ rsa_gen_key:nrbits:exponent:result rsa_init( &ctx, 0, 0 ); - TEST_ASSERT( rsa_gen_key( &ctx, ctr_drbg_random, &ctr_drbg, {nrbits}, {exponent} ) == {result} ); - if( {result} == 0 ) + TEST_ASSERT( rsa_gen_key( &ctx, ctr_drbg_random, &ctr_drbg, nrbits, exponent ) == result ); + if( result == 0 ) { TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 ); } rsa_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -rsa_selftest: +/* BEGIN_CASE */ +void rsa_selftest() { TEST_ASSERT( rsa_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_shax.function b/tests/suites/test_suite_shax.function index 75fad336a..3ce23e2eb 100644 --- a/tests/suites/test_suite_shax.function +++ b/tests/suites/test_suite_shax.function @@ -1,11 +1,11 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include #include #include -END_HEADER +/* END_HEADER */ -BEGIN_CASE -sha1:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA1_C */ +void sha1( char *hex_src_string, char *hex_hash_string ) { unsigned char src_str[10000]; unsigned char hash_str[10000]; @@ -16,17 +16,17 @@ sha1:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 41); - src_len = unhexify( src_str, {hex_src_string} ); + src_len = unhexify( src_str, hex_src_string ); sha1( src_str, src_len, output ); hexify( hash_str, output, 20 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha224:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA256_C */ +void sha224(char *hex_src_string, char *hex_hash_string ) { unsigned char src_str[10000]; unsigned char hash_str[10000]; @@ -37,17 +37,17 @@ sha224:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 57); - src_len = unhexify( src_str, {hex_src_string} ); + src_len = unhexify( src_str, hex_src_string ); sha256( src_str, src_len, output, 1 ); hexify( hash_str, output, 28 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha256:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA256_C */ +void sha256(char *hex_src_string, char *hex_hash_string ) { unsigned char src_str[10000]; unsigned char hash_str[10000]; @@ -58,17 +58,17 @@ sha256:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 65); - src_len = unhexify( src_str, {hex_src_string} ); + src_len = unhexify( src_str, hex_src_string ); sha256( src_str, src_len, output, 0 ); hexify( hash_str, output, 32 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha384:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA512_C */ +void sha384(char *hex_src_string, char *hex_hash_string ) { unsigned char src_str[10000]; unsigned char hash_str[10000]; @@ -79,17 +79,17 @@ sha384:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 97); - src_len = unhexify( src_str, {hex_src_string} ); + src_len = unhexify( src_str, hex_src_string ); sha512( src_str, src_len, output, 1 ); hexify( hash_str, output, 48 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha512:hex_src_string:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA512_C */ +void sha512(char *hex_src_string, char *hex_hash_string ) { unsigned char src_str[10000]; unsigned char hash_str[10000]; @@ -100,17 +100,17 @@ sha512:hex_src_string:hex_hash_string memset(hash_str, 0x00, 10000); memset(output, 0x00, 129); - src_len = unhexify( src_str, {hex_src_string} ); + src_len = unhexify( src_str, hex_src_string ); sha512( src_str, src_len, output, 0); hexify( hash_str, output, 64 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha1_file:filename:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA1_C */ +void sha1_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[41]; unsigned char output[21]; @@ -118,15 +118,15 @@ sha1_file:filename:hex_hash_string memset(hash_str, 0x00, 41); memset(output, 0x00, 21); - sha1_file( {filename}, output); + sha1_file( filename, output); hexify( hash_str, output, 20 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha224_file:filename:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA256_C */ +void sha224_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[57]; unsigned char output[29]; @@ -134,15 +134,15 @@ sha224_file:filename:hex_hash_string memset(hash_str, 0x00, 57); memset(output, 0x00, 29); - sha256_file( {filename}, output, 1); + sha256_file( filename, output, 1); hexify( hash_str, output, 28 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha256_file:filename:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA256_C */ +void sha256_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[65]; unsigned char output[33]; @@ -150,15 +150,15 @@ sha256_file:filename:hex_hash_string memset(hash_str, 0x00, 65); memset(output, 0x00, 33); - sha256_file( {filename}, output, 0); + sha256_file( filename, output, 0); hexify( hash_str, output, 32 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha384_file:filename:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA512_C */ +void sha384_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[97]; unsigned char output[49]; @@ -166,15 +166,15 @@ sha384_file:filename:hex_hash_string memset(hash_str, 0x00, 97); memset(output, 0x00, 49); - sha512_file( {filename}, output, 1); + sha512_file( filename, output, 1); hexify( hash_str, output, 48 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha512_file:filename:hex_hash_string +/* BEGIN_CASE depends_on:POLARSSL_SHA512_C */ +void sha512_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[129]; unsigned char output[65]; @@ -182,30 +182,30 @@ sha512_file:filename:hex_hash_string memset(hash_str, 0x00, 129); memset(output, 0x00, 65); - sha512_file( {filename}, output, 0); + sha512_file( filename, output, 0); hexify( hash_str, output, 64 ); - TEST_ASSERT( strcmp( (char *) hash_str, {hex_hash_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha1_selftest: +/* BEGIN_CASE depends_on:POLARSSL_SHA1_C */ +void sha1_selftest() { TEST_ASSERT( sha1_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha256_selftest: +/* BEGIN_CASE depends_on:POLARSSL_SHA256_C */ +void sha256_selftest() { TEST_ASSERT( sha256_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -sha512_selftest: +/* BEGIN_CASE depends_on:POLARSSL_SHA512_C */ +void sha512_selftest() { TEST_ASSERT( sha512_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_version.function b/tests/suites/test_suite_version.function index 06f63b6e9..b28707f34 100644 --- a/tests/suites/test_suite_version.function +++ b/tests/suites/test_suite_version.function @@ -1,13 +1,14 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_VERSION_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_VERSION_C + * END_DEPENDENCIES + */ -BEGIN_CASE -check_compiletime_version:version_str +/* BEGIN_CASE */ +void check_compiletime_version( char *version_str ) { char build_str[100]; char build_str_full[100]; @@ -29,12 +30,12 @@ check_compiletime_version:version_str TEST_ASSERT( build_int == POLARSSL_VERSION_NUMBER ); TEST_ASSERT( strcmp( build_str, POLARSSL_VERSION_STRING ) == 0 ); TEST_ASSERT( strcmp( build_str_full, POLARSSL_VERSION_STRING_FULL ) == 0 ); - TEST_ASSERT( strcmp( {version_str}, POLARSSL_VERSION_STRING ) == 0 ); + TEST_ASSERT( strcmp( version_str, POLARSSL_VERSION_STRING ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -check_runtime_version:version_str +/* BEGIN_CASE */ +void check_runtime_version( char *version_str ) { char build_str[100]; char get_str[100]; @@ -55,10 +56,10 @@ check_runtime_version:version_str (get_int >> 24) & 0xFF, (get_int >> 16) & 0xFF, (get_int >> 8) & 0xFF ); - snprintf( build_str_full, 100, "PolarSSL %s", {version_str} ); + snprintf( build_str_full, 100, "PolarSSL %s", version_str ); - TEST_ASSERT( strcmp( build_str, {version_str} ) == 0 ); + TEST_ASSERT( strcmp( build_str, version_str ) == 0 ); TEST_ASSERT( strcmp( build_str_full, get_str_full ) == 0 ); - TEST_ASSERT( strcmp( {version_str}, get_str ) == 0 ); + TEST_ASSERT( strcmp( version_str, get_str ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_x509parse.data b/tests/suites/test_suite_x509parse.data index caa525d7d..2a3e1c85a 100644 --- a/tests/suites/test_suite_x509parse.data +++ b/tests/suites/test_suite_x509parse.data @@ -80,7 +80,7 @@ x509_crl_info:"data_files/crl_sha512.pem":"CRL version \: 1\nissuer name \: X509 Parse RSA Key #1 (No password when required) depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509parse_keyfile_rsa:"data_files/test-ca.key":NULL:POLARSSL_ERR_X509_PASSWORD_REQUIRED +x509parse_keyfile_rsa:"data_files/test-ca.key":"NULL":POLARSSL_ERR_X509_PASSWORD_REQUIRED X509 Parse RSA Key #2 (Correct password) depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO @@ -212,11 +212,11 @@ x509parse_public_keyfile_ec:"data_files/ec_521_pub.pem":0 X509 Parse EC Key #1 (SEC1 DER) depends_on:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED -x509parse_keyfile_ec:"data_files/ec_prv.sec1.der":NULL:0 +x509parse_keyfile_ec:"data_files/ec_prv.sec1.der":"NULL":0 X509 Parse EC Key #2 (SEC1 PEM) depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED -x509parse_keyfile_ec:"data_files/ec_prv.sec1.pem":NULL:0 +x509parse_keyfile_ec:"data_files/ec_prv.sec1.pem":"NULL":0 X509 Parse EC Key #3 (SEC1 PEM encrypted) depends_on:POLARSSL_DES_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED @@ -224,18 +224,18 @@ x509parse_keyfile_ec:"data_files/ec_prv.sec1.pw.pem":"polar":0 X509 Parse EC Key #4 (PKCS8 DER) depends_on:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED -x509parse_keyfile_ec:"data_files/ec_prv.pk8.der":NULL:0 +x509parse_keyfile_ec:"data_files/ec_prv.pk8.der":"NULL":0 X509 Parse EC Key #5 (PKCS8 PEM) depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED -x509parse_keyfile_ec:"data_files/ec_prv.pk8.pem":NULL:0 +x509parse_keyfile_ec:"data_files/ec_prv.pk8.pem":"NULL":0 X509 Parse EC Key #6 (PKCS8 encrypted DER) -depends_on:POLARSSL_DES_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED +depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED x509parse_keyfile_ec:"data_files/ec_prv.pk8.pw.der":"polar":0 X509 Parse EC Key #7 (PKCS8 encrypted PEM) -depends_on:POLARSSL_DES_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED +depends_on:POLARSSL_DES_C:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED x509parse_keyfile_ec:"data_files/ec_prv.pk8.pw.pem":"polar":0 X509 Parse EC Key #8 (SEC1 PEM, secp224r1) @@ -256,167 +256,167 @@ x509parse_keyfile_ec:"data_files/ec_521_prv.pem":NULL:0 X509 Get Distinguished Name #1 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_dn_gets:"data_files/server1.crt":subject:"C=NL, O=PolarSSL, CN=PolarSSL Server 1" +x509_dn_gets:"data_files/server1.crt":"subject":"C=NL, O=PolarSSL, CN=PolarSSL Server 1" X509 Get Distinguished Name #2 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_dn_gets:"data_files/server1.crt":issuer:"C=NL, O=PolarSSL, CN=PolarSSL Test CA" +x509_dn_gets:"data_files/server1.crt":"issuer":"C=NL, O=PolarSSL, CN=PolarSSL Test CA" X509 Get Distinguished Name #3 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_dn_gets:"data_files/server2.crt":subject:"C=NL, O=PolarSSL, CN=localhost" +x509_dn_gets:"data_files/server2.crt":"subject":"C=NL, O=PolarSSL, CN=localhost" X509 Get Distinguished Name #4 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_dn_gets:"data_files/server2.crt":issuer:"C=NL, O=PolarSSL, CN=PolarSSL Test CA" +x509_dn_gets:"data_files/server2.crt":"issuer":"C=NL, O=PolarSSL, CN=PolarSSL Test CA" X509 Time Expired #1 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_time_expired:"data_files/server1.crt":valid_from:1 +x509_time_expired:"data_files/server1.crt":"valid_from":1 X509 Time Expired #2 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_time_expired:"data_files/server1.crt":valid_to:0 +x509_time_expired:"data_files/server1.crt":"valid_to":0 X509 Time Expired #3 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_time_expired:"data_files/server2.crt":valid_from:1 +x509_time_expired:"data_files/server2.crt":"valid_from":1 X509 Time Expired #4 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_time_expired:"data_files/server2.crt":valid_to:0 +x509_time_expired:"data_files/server2.crt":"valid_to":0 X509 Time Expired #5 depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_time_expired:"data_files/test-ca.crt":valid_from:1 +x509_time_expired:"data_files/test-ca.crt":"valid_from":1 X509 Time Expired #6:POLARSSL_FS_IO depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_time_expired:"data_files/test-ca.crt":valid_to:0 +x509_time_expired:"data_files/test-ca.crt":"valid_to":0 X509 Certificate verification #1 (Revoked Cert, Expired CRL) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl_expired.pem":NULL:POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED | BADCRL_EXPIRED:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl_expired.pem":"NULL":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED | BADCRL_EXPIRED:"NULL" X509 Certificate verification #2 (Revoked Cert, Expired CRL) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl_expired.pem":"PolarSSL Server 1":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED | BADCRL_EXPIRED:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl_expired.pem":"PolarSSL Server 1":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED | BADCRL_EXPIRED:"NULL" X509 Certificate verification #3 (Revoked Cert, Expired CRL, CN Mismatch) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl_expired.pem":"PolarSSL Wrong CN":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED | BADCRL_EXPIRED | BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl_expired.pem":"PolarSSL Wrong CN":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED | BADCRL_EXPIRED | BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #4 (Valid Cert, Expired CRL) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server2.crt":"data_files/test-ca.crt":"data_files/crl_expired.pem":NULL:POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCRL_EXPIRED:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server2.crt":"data_files/test-ca.crt":"data_files/crl_expired.pem":"NULL":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCRL_EXPIRED:"NULL" X509 Certificate verification #5 (Revoked Cert) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED:"NULL" X509 Certificate verification #6 (Revoked Cert) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl.pem":"PolarSSL Server 1":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl.pem":"PolarSSL Server 1":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED:"NULL" X509 Certificate verification #7 (Revoked Cert, CN Mismatch) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl.pem":"PolarSSL Wrong CN":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED | BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server1.crt":"data_files/test-ca.crt":"data_files/crl.pem":"PolarSSL Wrong CN":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_REVOKED | BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #8 (Valid Cert) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server2.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:0:0:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server2.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":0:0:"NULL" X509 Certificate verification #9 (Not trusted Cert) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server2.crt":"data_files/server1.crt":"data_files/crl.pem":NULL:POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_NOT_TRUSTED:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/server2.crt":"data_files/server1.crt":"data_files/crl.pem":"NULL":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_NOT_TRUSTED:"NULL" X509 Certificate verification #10 (Not trusted Cert, Expired CRL) depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server2.crt":"data_files/server1.crt":"data_files/crl_expired.pem":NULL:POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_NOT_TRUSTED:NULL +x509_verify:"data_files/server2.crt":"data_files/server1.crt":"data_files/crl_expired.pem":"NULL":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_NOT_TRUSTED:"NULL" X509 Certificate verification #12 (Valid Cert MD4 Digest) -depends_on:POLARSSL_MD4_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_md4.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:0:0:NULL +depends_on:POLARSSL_MD4_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_md4.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":0:0:"NULL" X509 Certificate verification #13 (Valid Cert MD5 Digest) -depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_md5.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:0:0:NULL +depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_md5.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":0:0:"NULL" X509 Certificate verification #14 (Valid Cert SHA1 Digest) -depends_on:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_sha1.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:0:0:NULL +depends_on:POLARSSL_SHA1_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_sha1.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":0:0:"NULL" X509 Certificate verification #15 (Valid Cert SHA224 Digest) -depends_on:POLARSSL_SHA256_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_sha224.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:0:0:NULL +depends_on:POLARSSL_SHA256_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_sha224.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":0:0:"NULL" X509 Certificate verification #16 (Valid Cert SHA256 Digest) -depends_on:POLARSSL_SHA256_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_sha256.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:0:0:NULL +depends_on:POLARSSL_SHA256_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_sha256.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":0:0:"NULL" X509 Certificate verification #17 (Valid Cert SHA384 Digest) -depends_on:POLARSSL_SHA512_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_sha384.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:0:0:NULL +depends_on:POLARSSL_SHA512_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_sha384.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":0:0:"NULL" X509 Certificate verification #18 (Valid Cert SHA512 Digest) -depends_on:POLARSSL_SHA512_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_sha512.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:0:0:NULL +depends_on:POLARSSL_SHA512_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_sha512.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":0:0:"NULL" X509 Certificate verification #19 (Valid Cert, denying callback) -depends_on:POLARSSL_SHA512_C:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_sha512.crt":"data_files/test-ca.crt":"data_files/crl.pem":NULL:POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_OTHER:verify_none +depends_on:POLARSSL_SHA512_C:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_sha512.crt":"data_files/test-ca.crt":"data_files/crl.pem":"NULL":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_OTHER:"verify_none" X509 Certificate verification #20 (Not trusted Cert, allowing callback) depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/server2.crt":"data_files/server1.crt":"data_files/crl_expired.pem":NULL:0:0:verify_all +x509_verify:"data_files/server2.crt":"data_files/server1.crt":"data_files/crl_expired.pem":"NULL":0:0:"verify_all" X509 Certificate verification #21 (domain matching wildcard certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_wildcard.crt":"data_files/test-ca.crt":"data_files/crl.pem":"mail.example.com":0:0:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_wildcard.crt":"data_files/test-ca.crt":"data_files/crl.pem":"mail.example.com":0:0:"NULL" X509 Certificate verification #22 (domain not matching wildcard certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_wildcard.crt":"data_files/test-ca.crt":"data_files/crl.pem":"mail.example.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_wildcard.crt":"data_files/test-ca.crt":"data_files/crl.pem":"mail.example.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #23 (domain not matching wildcard certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_wildcard.crt":"data_files/test-ca.crt":"data_files/crl.pem":"example.com":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_wildcard.crt":"data_files/test-ca.crt":"data_files/crl.pem":"example.com":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #24 (domain matching CN of multi certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"www.example.com":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"www.example.com":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #25 (domain matching multi certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"example.net":0:0:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"example.net":0:0:"NULL" X509 Certificate verification #26 (domain not matching multi certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"www.example.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"www.example.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #27 (domain not matching multi certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"xample.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"xample.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #27 (domain not matching multi certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"bexample.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"bexample.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #28 (domain not matching wildcard in multi certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"example.org":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"example.org":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH:"NULL" X509 Certificate verification #29 (domain matching wildcard in multi certificate) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"mail.example.org":0:0:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi.crt":"data_files/test-ca.crt":"data_files/crl.pem":"mail.example.org":0:0:"NULL" X509 Certificate verification #30 (domain matching multi certificate without CN) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi_nocn.crt":"data_files/test-ca.crt":"data_files/crl.pem":"www.shotokan-braunschweig.de":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_NOT_TRUSTED:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi_nocn.crt":"data_files/test-ca.crt":"data_files/crl.pem":"www.shotokan-braunschweig.de":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_NOT_TRUSTED:"NULL" X509 Certificate verification #31 (domain not matching multi certificate without CN) -depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO -x509_verify:"data_files/cert_example_multi_nocn.crt":"data_files/test-ca.crt":"data_files/crl.pem":"www.example.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH + BADCERT_NOT_TRUSTED:NULL +depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA1_C +x509_verify:"data_files/cert_example_multi_nocn.crt":"data_files/test-ca.crt":"data_files/crl.pem":"www.example.net":POLARSSL_ERR_X509_CERT_VERIFY_FAILED:BADCERT_CN_MISMATCH + BADCERT_NOT_TRUSTED:"NULL" X509 Parse Selftest depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_SELF_TEST diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function index b6383d734..cec4d8d8d 100644 --- a/tests/suites/test_suite_x509parse.function +++ b/tests/suites/test_suite_x509parse.function @@ -1,4 +1,4 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include #include #include @@ -23,14 +23,15 @@ int verify_all( void *data, x509_cert *crt, int certificate_depth, int *flags ) return 0; } -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_X509_PARSE_C:POLARSSL_BIGNUM_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_X509_PARSE_C:POLARSSL_BIGNUM_C + * END_DEPENDENCIES + */ -BEGIN_CASE -x509_cert_info:crt_file:result_str +/* BEGIN_CASE */ +void x509_cert_info( char *crt_file, char *result_str ) { x509_cert crt; char buf[2000]; @@ -39,7 +40,7 @@ x509_cert_info:crt_file:result_str memset( &crt, 0, sizeof( x509_cert ) ); memset( buf, 0, 2000 ); - TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); + TEST_ASSERT( x509parse_crtfile( &crt, crt_file ) == 0 ); res = x509parse_cert_info( buf, 2000, "", &crt ); x509_free( &crt ); @@ -47,12 +48,12 @@ x509_cert_info:crt_file:result_str TEST_ASSERT( res != -1 ); TEST_ASSERT( res != -2 ); - TEST_ASSERT( strcmp( buf, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( buf, result_str ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509_crl_info:crl_file:result_str +/* BEGIN_CASE */ +void x509_crl_info( char *crl_file, char *result_str ) { x509_crl crl; char buf[2000]; @@ -61,7 +62,7 @@ x509_crl_info:crl_file:result_str memset( &crl, 0, sizeof( x509_crl ) ); memset( buf, 0, 2000 ); - TEST_ASSERT( x509parse_crlfile( &crl, {crl_file} ) == 0 ); + TEST_ASSERT( x509parse_crlfile( &crl, crl_file ) == 0 ); res = x509parse_crl_info( buf, 2000, "", &crl ); x509_crl_free( &crl ); @@ -69,85 +70,116 @@ x509_crl_info:crl_file:result_str TEST_ASSERT( res != -1 ); TEST_ASSERT( res != -2 ); - TEST_ASSERT( strcmp( buf, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( buf, result_str ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509_verify:crt_file:ca_file:crl_file:cn_name:result:flags:verify_callback +/* BEGIN_CASE */ +void x509_verify( char *crt_file, char *ca_file, char *crl_file, + char *cn_name_str, int result, int flags_result, + char *verify_callback ) { x509_cert crt; x509_cert ca; x509_crl crl; int flags = 0; int res; + int (*f_vrfy)(void *, x509_cert *, int, int *) = NULL; + char * cn_name = NULL; memset( &crt, 0, sizeof( x509_cert ) ); memset( &ca, 0, sizeof( x509_cert ) ); memset( &crl, 0, sizeof( x509_crl ) ); - TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); - TEST_ASSERT( x509parse_crtfile( &ca, {ca_file} ) == 0 ); - TEST_ASSERT( x509parse_crlfile( &crl, {crl_file} ) == 0 ); + if( strcmp( cn_name_str, "NULL" ) != 0 ) + cn_name = cn_name_str; - res = x509parse_verify( &crt, &ca, &crl, {cn_name}, &flags, {verify_callback}, NULL ); + if( strcmp( verify_callback, "NULL" ) == 0 ) + f_vrfy = NULL; + else if( strcmp( verify_callback, "verify_none" ) == 0 ) + f_vrfy = verify_none; + else if( strcmp( verify_callback, "verify_all" ) == 0 ) + f_vrfy = verify_all; + else + TEST_ASSERT( "No known verify callback selected" == 0 ); + + TEST_ASSERT( x509parse_crtfile( &crt, crt_file ) == 0 ); + TEST_ASSERT( x509parse_crtfile( &ca, ca_file ) == 0 ); + TEST_ASSERT( x509parse_crlfile( &crl, crl_file ) == 0 ); + + res = x509parse_verify( &crt, &ca, &crl, cn_name, &flags, f_vrfy, NULL ); x509_free( &crt ); x509_free( &ca ); x509_crl_free( &crl ); - TEST_ASSERT( res == ( {result} ) ); - TEST_ASSERT( flags == ( {flags} ) ); + TEST_ASSERT( res == ( result ) ); + TEST_ASSERT( flags == ( flags_result ) ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509_dn_gets:crt_file:entity:result_str +/* BEGIN_CASE */ +void x509_dn_gets( char *crt_file, char *entity, char *result_str ) { x509_cert crt; char buf[2000]; - int res; + int res = 0; memset( &crt, 0, sizeof( x509_cert ) ); memset( buf, 0, 2000 ); - TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); - res = x509parse_dn_gets( buf, 2000, &crt.{entity} ); + TEST_ASSERT( x509parse_crtfile( &crt, crt_file ) == 0 ); + if( strcmp( entity, "subject" ) == 0 ) + res = x509parse_dn_gets( buf, 2000, &crt.subject ); + else if( strcmp( entity, "issuer" ) == 0 ) + res = x509parse_dn_gets( buf, 2000, &crt.issuer ); + else + TEST_ASSERT( "Unknown entity" == 0 ); x509_free( &crt ); TEST_ASSERT( res != -1 ); TEST_ASSERT( res != -2 ); - TEST_ASSERT( strcmp( buf, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( buf, result_str ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509_time_expired:crt_file:entity:result +/* BEGIN_CASE */ +void x509_time_expired( char *crt_file, char *entity, int result ) { x509_cert crt; memset( &crt, 0, sizeof( x509_cert ) ); - TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); - TEST_ASSERT( x509parse_time_expired( &crt.{entity} ) == {result} ); + TEST_ASSERT( x509parse_crtfile( &crt, crt_file ) == 0 ); + + if( strcmp( entity, "valid_from" ) == 0 ) + TEST_ASSERT( x509parse_time_expired( &crt.valid_from ) == result ); + else if( strcmp( entity, "valid_to" ) == 0 ) + TEST_ASSERT( x509parse_time_expired( &crt.valid_to ) == result ); + else + TEST_ASSERT( "Unknown entity" == 0 ); x509_free( &crt ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509parse_keyfile_rsa:key_file:password:result +/* BEGIN_CASE */ +void x509parse_keyfile_rsa( char *key_file, char *password, int result ) { rsa_context rsa; int res; + char *pwd = password; memset( &rsa, 0, sizeof( rsa_context ) ); - res = x509parse_keyfile_rsa( &rsa, {key_file}, {password} ); + if( strcmp( pwd, "NULL" ) == 0 ) + pwd = NULL; - TEST_ASSERT( res == {result} ); + res = x509parse_keyfile_rsa( &rsa, key_file, pwd ); + + TEST_ASSERT( res == result ); if( res == 0 ) { @@ -156,19 +188,19 @@ x509parse_keyfile_rsa:key_file:password:result rsa_free( &rsa ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509parse_public_keyfile_rsa:key_file:result +/* BEGIN_CASE */ +void x509parse_public_keyfile_rsa( char *key_file, int result ) { rsa_context rsa; int res; memset( &rsa, 0, sizeof( rsa_context ) ); - res = x509parse_public_keyfile_rsa( &rsa, {key_file} ); + res = x509parse_public_keyfile_rsa( &rsa, key_file ); - TEST_ASSERT( res == {result} ); + TEST_ASSERT( res == result ); if( res == 0 ) { @@ -177,19 +209,19 @@ x509parse_public_keyfile_rsa:key_file:result rsa_free( &rsa ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509parse_public_keyfile_ec:key_file:result +/* BEGIN_CASE */ +void x509parse_public_keyfile_ec( char *key_file, int result ) { pk_context ctx; int res; pk_init( &ctx ); - res = x509parse_public_keyfile( &ctx, {key_file} ); + res = x509parse_public_keyfile( &ctx, key_file ); - TEST_ASSERT( res == {result} ); + TEST_ASSERT( res == result ); if( res == 0 ) { @@ -201,19 +233,19 @@ x509parse_public_keyfile_ec:key_file:result pk_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509parse_keyfile_ec:key_file:password:result +/* BEGIN_CASE */ +void x509parse_keyfile_ec( char *key_file, char *password, int result ) { pk_context ctx; int res; pk_init( &ctx ); - res = x509parse_keyfile( &ctx, {key_file}, {password} ); + res = x509parse_keyfile( &ctx, key_file, password ); - TEST_ASSERT( res == {result} ); + TEST_ASSERT( res == result ); if( res == 0 ) { @@ -225,10 +257,10 @@ x509parse_keyfile_ec:key_file:password:result pk_free( &ctx ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509parse_crt:crt_data:result_str:result +/* BEGIN_CASE */ +void x509parse_crt( char *crt_data, char *result_str, int result ) { x509_cert crt; unsigned char buf[2000]; @@ -239,25 +271,25 @@ x509parse_crt:crt_data:result_str:result memset( buf, 0, 2000 ); memset( output, 0, 2000 ); - data_len = unhexify( buf, {crt_data} ); + data_len = unhexify( buf, crt_data ); - TEST_ASSERT( x509parse_crt( &crt, buf, data_len ) == ( {result} ) ); - if( ( {result} ) == 0 ) + TEST_ASSERT( x509parse_crt( &crt, buf, data_len ) == ( result ) ); + if( ( result ) == 0 ) { res = x509parse_cert_info( (char *) output, 2000, "", &crt ); - + TEST_ASSERT( res != -1 ); TEST_ASSERT( res != -2 ); - TEST_ASSERT( strcmp( (char *) output, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 ); } x509_free( &crt ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509parse_crl:crl_data:result_str:result +/* BEGIN_CASE */ +void x509parse_crl( char *crl_data, char *result_str, int result ) { x509_crl crl; unsigned char buf[2000]; @@ -268,50 +300,51 @@ x509parse_crl:crl_data:result_str:result memset( buf, 0, 2000 ); memset( output, 0, 2000 ); - data_len = unhexify( buf, {crl_data} ); + data_len = unhexify( buf, crl_data ); - TEST_ASSERT( x509parse_crl( &crl, buf, data_len ) == ( {result} ) ); - if( ( {result} ) == 0 ) + TEST_ASSERT( x509parse_crl( &crl, buf, data_len ) == ( result ) ); + if( ( result ) == 0 ) { res = x509parse_crl_info( (char *) output, 2000, "", &crl ); - + TEST_ASSERT( res != -1 ); TEST_ASSERT( res != -2 ); - TEST_ASSERT( strcmp( (char *) output, {result_str} ) == 0 ); + TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 ); } x509_crl_free( &crl ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509parse_key_rsa:key_data:result_str:result +/* BEGIN_CASE */ +void x509parse_key_rsa( char *key_data, char *result_str, int result ) { rsa_context rsa; unsigned char buf[2000]; unsigned char output[2000]; int data_len; + ((void) result_str); memset( &rsa, 0, sizeof( rsa_context ) ); memset( buf, 0, 2000 ); memset( output, 0, 2000 ); - data_len = unhexify( buf, {key_data} ); + data_len = unhexify( buf, key_data ); - TEST_ASSERT( x509parse_key_rsa( &rsa, buf, data_len, NULL, 0 ) == ( {result} ) ); - if( ( {result} ) == 0 ) + TEST_ASSERT( x509parse_key_rsa( &rsa, buf, data_len, NULL, 0 ) == ( result ) ); + if( ( result ) == 0 ) { TEST_ASSERT( 1 ); } rsa_free( &rsa ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -x509_selftest: +/* BEGIN_CASE */ +void x509_selftest() { TEST_ASSERT( x509_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function index e3bf12f72..680dfb4c4 100644 --- a/tests/suites/test_suite_x509write.function +++ b/tests/suites/test_suite_x509write.function @@ -1,16 +1,18 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include #include #include #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_X509_WRITE_C:POLARSSL_BIGNUM_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + * depends_on:POLARSSL_X509_WRITE_C:POLARSSL_BIGNUM_C + * END_DEPENDENCIES + */ -BEGIN_CASE -x509_cert_req_check:key_file:md_type:cert_req_check_file +/* BEGIN_CASE */ +void x509_cert_req_check( char *key_file, int md_type, + char *cert_req_check_file ) { rsa_context rsa; pem_context pem; @@ -41,17 +43,17 @@ x509_cert_req_check:key_file:md_type:cert_req_check_file strcpy( cur->name, "NL" ); memset( &rsa, 0, sizeof(rsa_context) ); - ret = x509parse_keyfile_rsa( &rsa, {key_file}, NULL ); + ret = x509parse_keyfile_rsa( &rsa, key_file, NULL ); TEST_ASSERT( ret == 0 ); if( ret != 0 ) - return 0; + return; - ret = x509_write_cert_req( buf, 4000, &rsa, &req_name, {md_type} ); + ret = x509_write_cert_req( buf, 4000, &rsa, &req_name, md_type ); TEST_ASSERT( ret >= 0 ); c = buf + 3999 - ret; - f = fopen( {cert_req_check_file}, "r" ); + f = fopen( cert_req_check_file, "r" ); TEST_ASSERT( f != NULL ); fread( check_buf, 1, 4000, f ); fclose( f ); @@ -71,4 +73,4 @@ x509_cert_req_check:key_file:md_type:cert_req_check_file rsa_free( &rsa ); pem_free( &pem ); } -END_CASE +/* END_CASE */ diff --git a/tests/suites/test_suite_xtea.function b/tests/suites/test_suite_xtea.function index e0ad026c4..748b50c36 100644 --- a/tests/suites/test_suite_xtea.function +++ b/tests/suites/test_suite_xtea.function @@ -1,13 +1,15 @@ -BEGIN_HEADER +/* BEGIN_HEADER */ #include -END_HEADER +/* END_HEADER */ -BEGIN_DEPENDENCIES -depends_on:POLARSSL_XTEA_C -END_DEPENDENCIES +/* BEGIN_DEPENDENCIES + *depends_on:POLARSSL_XTEA_C + * END_DEPENDENCIES + */ -BEGIN_CASE -xtea_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void xtea_encrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -20,19 +22,20 @@ xtea_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); xtea_setup( &ctx, key_str ); TEST_ASSERT( xtea_crypt_ecb( &ctx, XTEA_ENCRYPT, src_str, output ) == 0 ); hexify( dst_str, output, 8 ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -xtea_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string +/* BEGIN_CASE */ +void xtea_decrypt_ecb( char *hex_key_string, char *hex_src_string, + char *hex_dst_string ) { unsigned char key_str[100]; unsigned char src_str[100]; @@ -45,20 +48,20 @@ xtea_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string memset(dst_str, 0x00, 100); memset(output, 0x00, 100); - unhexify( key_str, {hex_key_string} ); - unhexify( src_str, {hex_src_string} ); + unhexify( key_str, hex_key_string ); + unhexify( src_str, hex_src_string ); xtea_setup( &ctx, key_str ); TEST_ASSERT( xtea_crypt_ecb( &ctx, XTEA_DECRYPT, src_str, output ) == 0 ); hexify( dst_str, output, 8 ); - TEST_ASSERT( strcmp( (char *) dst_str, {hex_dst_string} ) == 0 ); + TEST_ASSERT( strcmp( (char *) dst_str, hex_dst_string ) == 0 ); } -END_CASE +/* END_CASE */ -BEGIN_CASE -xtea_selftest: +/* BEGIN_CASE */ +void xtea_selftest() { TEST_ASSERT( xtea_self_test( 0 ) == 0 ); } -END_CASE +/* END_CASE */