Tests added
Signed-off-by: Pascal Brand <pascal.brand@st.com>
diff --git a/host/LICENSE b/host/LICENSE
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/host/LICENSE
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/host/lib/armv7/libcrypto.a b/host/lib/armv7/libcrypto.a
new file mode 100644
index 0000000..bfbea7f
--- /dev/null
+++ b/host/lib/armv7/libcrypto.a
Binary files differ
diff --git a/host/lib/armv8/libcrypto.a b/host/lib/armv8/libcrypto.a
new file mode 100644
index 0000000..c9f5236
--- /dev/null
+++ b/host/lib/armv8/libcrypto.a
Binary files differ
diff --git a/host/xtest/.gitignore b/host/xtest/.gitignore
new file mode 100644
index 0000000..2cccfcc
--- /dev/null
+++ b/host/xtest/.gitignore
@@ -0,0 +1,2 @@
+for_gp
+*.orig
diff --git a/host/xtest/Makefile b/host/xtest/Makefile
new file mode 100644
index 0000000..1f6960c
--- /dev/null
+++ b/host/xtest/Makefile
@@ -0,0 +1,130 @@
+# Normally this makefile shouldn't be called directly and we expect the output
+# path to be on a certain location to fit together with the other OP-TEE
+# gits and helper scripts.
+ifeq ($O,)
+$(error output path should be specified when calling this makefile)
+endif
+
+# By default we expect optee_client exported folder to be on a certain relative
+# path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will
+# be used instead.
+OPTEE_CLIENT_EXPORT ?= ../../../optee_client/out/export
+
+CC := $(CROSS_COMPILE)gcc
+CPP := $(CROSS_COMPILE)cpp
+LD := $(CROSS_COMPILE)ld
+AR := $(CROSS_COMPILE)ar
+NM := $(CROSS_COMPILE)nm
+OBJCOPY := $(CROSS_COMPILE)objcopy
+OBJDUMP := $(CROSS_COMPILE)objdump
+READELF := $(CROSS_COMPILE)readelf
+
+srcs := xtest_1000.c \
+ xtest_4000.c \
+ xtest_5000.c \
+ xtest_6000.c \
+ xtest_7000.c \
+ xtest_10000.c \
+ xtest_helpers.c \
+ xtest_main.c \
+ xtest_test.c \
+ adbg/src/adbg_case.c \
+ adbg/src/adbg_enum.c \
+ adbg/src/adbg_expect.c \
+ adbg/src/adbg_log.c \
+ adbg/src/adbg_mts.c \
+ adbg/src/adbg_run.c \
+ adbg/src/adbg_util.c \
+ adbg/src/r_list_genutil.c \
+ adbg/src/security_utils_hex.c \
+ adbg/src/security_utils_mem.c
+
+ifeq ($(CFG_GP_TESTSUITE_ENABLE), y)
+srcs += xtest_7500.c \
+ xtest_8000.c \
+ xtest_8500.c \
+ xtest_9000.c
+endif
+
+objs := $(patsubst %.c,$(O)/%.o, $(srcs))
+
+CFLAGS += -I./
+CFLAGS += -I./adbg/include
+CFLAGS += -I./xml/include
+
+CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include
+CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
+
+CFLAGS += -I../../ta/create_fail_test/include
+CFLAGS += -I../../ta/crypt/include
+CFLAGS += -I../../ta/enc_fs/include
+CFLAGS += -I../../ta/os_test/include
+CFLAGS += -I../../ta/rpc_test/include
+CFLAGS += -I../../ta/sims/include
+CFLAGS += -I../../ta/storage/include
+ifeq ($(CFG_GP_TESTSUITE_ENABLE),y)
+CFLAGS += -I../../ta/GP_TTA_Arithmetical
+CFLAGS += -I../../ta/GP_TTA_Crypto
+CFLAGS += -I../../ta/GP_TTA_DS
+CFLAGS += -I../../ta/GP_TTA_TCF
+CFLAGS += -I../../ta/GP_TTA_TCF_ICA
+CFLAGS += -I../../ta/GP_TTA_TCF_ICA2
+CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA
+CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA
+CFLAGS += -I../../ta/GP_TTA_Time
+CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke
+CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession
+CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke
+CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
+CFLAGS += -I../../ta/GP_TTA_testingClientAPI
+
+# need more include: openssl
+CFLAGS += -Ifor_gp/include
+
+# need more libraries: openssl
+ifneq ($(PLATFORM_FLAVOR),qemu_virt)
+LDFLAGS += for_gp/lib/libcrypto.a
+else
+LDFLAGS += -lcrypto
+endif
+
+# need more flags
+CFLAGS += -DXTEST_WITH_GP_TESTS
+
+endif
+
+# FIXME: Check if and why we need this flag?
+CFLAGS += -DUSER_SPACE
+
+ifneq ($(CFG_GP_TESTSUITE_ENABLE),y)
+CFLAGS += -Wall -Wcast-align -Werror \
+ -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
+ -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
+ -Wmissing-declarations -Wmissing-format-attribute \
+ -Wmissing-include-dirs -Wmissing-noreturn \
+ -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+ -Wshadow -Wstrict-prototypes -Wswitch-default \
+ -Wwrite-strings \
+ -Wno-missing-field-initializers -Wno-format-zero-length
+endif
+
+LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
+LDFLAGS += -lpthread
+
+.PHONY: all
+all: xtest
+
+xtest: $(objs)
+ @echo " LD $(O)/$@"
+ $(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
+
+$(O)/%.o: $(CURDIR)/%.c
+ $(q)mkdir -p $(O)/adbg/src
+ @echo ' CC $<'
+ $(q)$(CC) $(CFLAGS) -c $< -o $@
+
+.PHONY: clean
+clean:
+ @echo ' CLEAN $(O)'
+ $(q)rm -f $(O)/xtest
+ $(q)$(foreach obj,$(objs), rm -f $(obj))
diff --git a/host/xtest/adbg/include/adbg.h b/host/xtest/adbg/include/adbg.h
new file mode 100644
index 0000000..f3fa8ae
--- /dev/null
+++ b/host/xtest/adbg/include/adbg.h
@@ -0,0 +1,464 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef ADBG_H
+#define ADBG_H
+#include <stddef.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#define ADBG_STRING_LENGTH_MAX (1024)
+
+typedef struct {
+ size_t ColumnWidth;
+ const char *Text_p;
+} ADBG_LogTable_t;
+
+typedef struct {
+ char Corner;
+ char Vertical;
+ char Horizontal;
+} ADBG_LogTableShapes_t;
+
+
+/* Typedef for function pointers used in the clients handle signal function. */
+typedef uint32_t (ADBG_SignalFunction_t)(uint8_t);
+
+/*
+ * Case definitions
+ */
+
+/**
+ * Defines a test case
+ *
+ * Used in the follwing way for readability:
+ */
+#if 0 /* #if 0 to avoid nested comments */
+ADBG_CASE_DEFINE(TEST_1001, TEST_Test_1001,
+ /* Title */
+ "My test case title",
+ /* Short description */
+ "Verifies that functionality X is working",
+ /* Requirement IDs */
+ "?",
+ /* How to implement */
+ "The function should return OK"
+ );
+#endif
+
+#define ADBG_CASE_DEFINE(TestID, Run, Title, ShortDescription, \
+ RequiredMentIDs, HowToImplement) \
+ const ADBG_Case_Definition_t TestID = {#TestID, Title, Run, \
+ ShortDescription, \
+ RequiredMentIDs, HowToImplement }
+
+#define ADBG_CASE_DECLARE(name) \
+ extern const ADBG_Case_Definition_t name
+
+
+typedef struct ADBG_Case ADBG_Case_t;
+
+
+typedef struct {
+ const char *TestID_p;
+ const char *Title_p;
+ void (*Run_fp)(ADBG_Case_t *ADBG_Case_pp);
+ const char *ShortDescription_p;
+ const char *RequirementIDs_p;
+ const char *HowToImplement_p;
+} ADBG_Case_Definition_t;
+
+typedef struct {
+ const ADBG_Case_Definition_t *CaseDefinition_p;
+ const char *WhyDisabled_p;
+} ADBG_Case_SuiteEntry_t;
+
+typedef struct {
+ void *Data_p;
+} ADBG_SuiteData_t;
+
+typedef struct {
+ const char *SuiteID_p;
+ void (*CleanupSuite_fp)(ADBG_SuiteData_t *SuiteData_p);
+ const ADBG_Case_SuiteEntry_t *SuiteEntries_p;
+} ADBG_Suite_Definition_t;
+
+/*
+ * Suite definitions
+ */
+
+/**
+ * Declares a suite defined in a C-file.
+ */
+#define ADBG_SUITE_DECLARE(Name) \
+ extern const ADBG_Suite_Definition_t ADBG_Suite_ ## Name;
+
+#define ADBG_SUITE_DEFINE_BEGIN(Name, CleanupSuite) \
+ extern const ADBG_Case_SuiteEntry_t ADBG_SuiteEntries_ ## Name[]; \
+ const ADBG_Suite_Definition_t ADBG_Suite_ ## Name = \
+ { #Name, CleanupSuite, ADBG_SuiteEntries_ ## Name }; \
+ const ADBG_Case_SuiteEntry_t ADBG_SuiteEntries_ ## Name[] = {
+/**
+ * Defines a suite entry, this is the name of a case.
+ */
+#define ADBG_SUITE_ENTRY(name, WhyDisabledOrNULL) \
+ { &name, WhyDisabledOrNULL },
+
+#define ADBG_SUITE_DEFINE_END() { NULL, NULL } };
+
+/*************************************************************************
+* 2.3 IDbg table definitions
+*************************************************************************/
+
+typedef struct {
+ const char *Command_p;
+ const char *Help_p;
+} ADBG_HelpTable_t;
+
+#define ADBG_IDBG_TBL_HELP(Command, Help) \
+ { Command, Help },
+
+/*
+ * Enum table definitions
+ */
+
+#define ADBG_ENUM_TABLE_DECLARE(Name) \
+ extern const ADBG_EnumTable_t ADBG_EnumTable_ ## Name[]
+
+#define ADBG_ENUM_TABLE_DEFINE_BEGIN(Name) \
+ const ADBG_EnumTable_t ADBG_EnumTable_ ## Name[] = {
+#define ADBG_ENUM_TABLE_ENTRY(Value) { Value, #Value }
+
+#define ADBG_ENUM_TABLE_DEFINE_END(Name) , { 0, NULL } }
+
+typedef struct {
+ int Value;
+ const char *const Name_p;
+} ADBG_EnumEntry_t;
+
+typedef ADBG_EnumEntry_t ADBG_EnumTable_t;
+
+ADBG_ENUM_TABLE_DECLARE(Boolean);
+
+#define ADBG_ASSERT_STRINGS_EQUAL(Case_p, Str1_p, Str2_p) \
+ Do_ADBG_Assert(Case_p, __FILE__, __LINE__, \
+ Str1_p != NULL && Str2_p != NULL && \
+ strcmp(Str1_p, Str2_p) == 0, \
+ "Assertion \"%s\" == \"%s\" failed", \
+ #Str1_p, #Str2_p)
+
+#define ADBG_ASSERT_EQUAL(Case_p, Buf1_p, Buf2_p, Length) \
+ Do_ADBG_Assert(Case_p, __FILE__, __LINE__, \
+ memcmp(Buf1_p, Buf2_p, Length) == 0, \
+ "Buffer equality of %s and %s Length %d failed", \
+ #Buf1_p, #Buf2_p, Length)
+
+#define ADBG_ASSERT(Case_p, Expression) \
+ Do_ADBG_Assert(Case_p, __FILE__, __LINE__, Expression, \
+ "Assertion %s failed", #Expression)
+
+/**
+ * Explicitly add an error to the test case
+ */
+#define ADBG_ERROR(Case_p) \
+ Do_ADBG_Assert(Case_p, __FILE__, __LINE__, False, \
+ "Excplicitly added error")
+
+
+void Do_ADBG_Assert(ADBG_Case_t *const Case_p, const char *const FileName_p,
+ const int LineNumber, const bool ExpressionOK,
+ const char *const Format_p,
+ ...) __attribute__((__format__(__printf__, 5, 6)));
+
+
+/*
+ * Expect functions/macros
+ */
+
+#define ADBG_EXPECT(Case_p, Expected, Got) \
+ ADBG_EXPECT_ENUM(Case_p, Expected, Got, NULL)
+
+#define ADBG_EXPECT_NOT(Case_p, Expected, Got) \
+ ADBG_EXPECT_NOT_ENUM(Case_p, Expected, Got, NULL)
+
+#define ADBG_EXPECT_ENUM(Case_p, Expected, Got, EnumTable_p) \
+ Do_ADBG_Expect(Case_p, __FILE__, __LINE__, Expected, Got, #Got, \
+ EnumTable_p)
+
+#define ADBG_EXPECT_NOT_ENUM(Case_p, NotExpected, Got, EnumTable_p) \
+ Do_ADBG_ExpectNot(Case_p, __FILE__, __LINE__, \
+ NotExpected, Got, #Got, EnumTable_p)
+
+#define ADBG_EXPECT_REQUEST_STATUS(Case_p, Expected, Got) \
+ ADBG_EXPECT_ENUM(Case_p, Expected, Got, ADBG_EnumTable_RequestStatus)
+
+#define ADBG_EXPECT_REQUEST_STATUS_OK(Case_p, Got) \
+ ADBG_EXPECT_REQUEST_STATUS(Case_p, REQUEST_OK, Got)
+
+#define ADBG_EXPECT_EVENT_STATUS(Case_p, Expected, Got) \
+ ADBG_EXPECT_ENUM(Case_p, Expected, Got, ADBG_EnumTable_EventStatus)
+
+#define ADBG_EXPECT_EVENT_STATUS_OK(Case_p, Got) \
+ ADBG_EXPECT_REQUEST_STATUS(Case_p, GS_EVENT_OK, Got)
+
+#define ADBG_EXPECT_BOOLEAN(Case_p, Expected, Got) \
+ ADBG_EXPECT_ENUM(Case_p, Expected, Got, ADBG_EnumTable_Boolean)
+
+#define ADBG_EXPECT_TRUE(Case_p, Got) \
+ ADBG_EXPECT_ENUM(Case_p, true, Got, ADBG_EnumTable_Boolean)
+
+#define ADBG_EXPECT_EQUAL(Case_p, Buf1_p, Buf2_p, Length) \
+ ADBG_EXPECT(Case_p, 0, memcmp(Buf1_p, Buf2_p, Length))
+
+#define ADBG_EXPECT_BUFFER(Case_p, ExpBuf_p, ExpBufLen, GotBuf_p, GotBufLen) \
+ Do_ADBG_ExpectBuffer(Case_p, __FILE__, __LINE__, \
+ ExpBuf_p, ExpBufLen, #GotBuf_p, GotBuf_p, \
+ #GotBufLen, GotBufLen)
+
+#define ADBG_EXPECT_POINTER(Case_p, Expected, Got) \
+ Do_ADBG_ExpectPointer(Case_p, __FILE__, __LINE__, Expected, Got, #Got)
+
+#define ADBG_EXPECT_NOT_NULL(Case_p, Got) \
+ Do_ADBG_ExpectPointerNotNULL(Case_p, __FILE__, __LINE__, Got, #Got)
+
+#define ADBG_EXPECT_COMPARE_SIGNED(Case_p, Val1, Compar, Val2) \
+ Do_ADBG_ExpectCompareSigned(Case_p, __FILE__, __LINE__, \
+ Val1, Val2, (Val1)Compar( \
+ Val2), #Val1, #Compar, #Val2)
+
+#define ADBG_EXPECT_COMPARE_UNSIGNED(Case_p, Val1, Compar, Val2) \
+ Do_ADBG_ExpectCompareUnsigned(Case_p, __FILE__, __LINE__, \
+ Val1, Val2, (Val1)Compar( \
+ Val2), #Val1, #Compar, #Val2)
+
+#define ADBG_EXPECT_COMPARE_POINTER(Case_p, Val1, Compar, Val2) \
+ Do_ADBG_ExpectComparePointer(Case_p, __FILE__, __LINE__, \
+ Val1, Val2, (Val1)Compar( \
+ Val2), #Val1, #Compar, #Val2)
+
+#define ADBG_REQUIRE(Case_p, Recovery, Expected, Got) {\
+ if (!ADBG_EXPECT(Case_p, Expected, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_ENUM(Case_p, Recovery, Expected, Got, EnumTable_p) {\
+ if (!ADBG_EXPECT_ENUM(Case_p, Expected, Got, EnumTable_p)) \
+ Recovery }
+
+#define ADBG_REQUIRE_REQUEST_STATUS(Case_p, Recovery, Expected, Got) {\
+ if (!ADBG_EXPECT_REQUEST_STATUS(Case_p, Expected, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_REQUEST_STATUS_OK(Case_p, Recovery, Got) {\
+ if (!ADBG_EXPECT_REQUEST_STATUS_OK(Case_p, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_EVENT_STATUS(Case_p, Recovery, Expected, Got) {\
+ if (!ADBG_EXPECT_EVENT_STATUS(Case_p, Expected, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_EVENT_STATUS_OK(Case_p, Recovery, Got) {\
+ if (!ADBG_EXPECT_EVENT_STATUS_OK(Case_p, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_BOOLEAN(Case_p, Recovery, Expected, Got) {\
+ if (!ADBG_EXPECT_BOOLEAN(Case_p, Expected, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_TRUE(Case_p, Recovery, Got) {\
+ if (!ADBG_EXPECT_TRUE(Case_p, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_EQUAL(Case_p, Recovery, Buf1_p, Buf2_p, Length) {\
+ if (!ADBG_EXPECT_EQUAL(Case_p, Buf1_p, Buf2_p, Length)) \
+ Recovery }
+
+#define ADBG_REQUIRE_BUFFER(Case_p, Recovery, ExpBuf_p, ExpBufLen, GotBuf_p, \
+ GotBufLen) {\
+ if (!ADBG_EXPECT_BUFFER(Case_p, ExpBuf_p, ExpBufLen, GotBuf_p, \
+ GotBufLen)) \
+ Recovery }
+
+#define ADBG_REQUIRE_POINTER(Case_p, Recovery, Expected, Got) {\
+ if (!ADBG_EXPECT_POINTER(Case_p, Expected, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_NOT_NULL(Case_p, Recovery, Got) {\
+ if (!ADBG_EXPECT_NOT_NULL(Case_p, Got)) \
+ Recovery }
+
+#define ADBG_REQUIRE_COMPARE_SIGNED(Case_p, Recovery, Val1, Compar, Val2) {\
+ if (!ADBG_EXPECT_COMPARE_SIGNED(Case_p, Val1, Compar, Val2)) \
+ Recovery }
+
+#define ADBG_REQUIRE_COMPARE_UNSIGNED(Case_p, Recovery, Val1, Compar, Val2) {\
+ if (!ADBG_EXPECT_COMPARE_UNSIGNED(Case_p, Val1, Compar, Val2)) \
+ Recovery }
+
+#define ADBG_REQUIRE_COMPARE_POINTER(Case_p, Recovery, Val1, Compar, Val2) {\
+ if (!ADBG_EXPECT_COMPARE_POINTER(Case_p, Val1, Compar, Val2)) \
+ Recovery }
+
+bool Do_ADBG_Expect(ADBG_Case_t *const Case_p, const char *const FileName_p,
+ const int LineNumber, const int Expected, const int Got,
+ const char *const GotVarName_p,
+ const ADBG_EnumTable_t *const EnumTable_p);
+
+bool Do_ADBG_ExpectNot(ADBG_Case_t *const Case_p, const char *const FileName_p,
+ const int LineNumber, const int NotExpected,
+ const int Got, const char *const GotVarName_p,
+ const ADBG_EnumTable_t *const EnumTable_p);
+
+bool Do_ADBG_ExpectBuffer(ADBG_Case_t *const Case_p,
+ const char *const FileName_p, const int LineNumber,
+ const void *const ExpectedBuffer_p,
+ const size_t ExpectedBufferLength,
+ const char *const GotBufferName_p,
+ const void *const GotBuffer_p,
+ const char *const GotBufferLengthName_p,
+ const size_t GotBufferLength);
+
+bool Do_ADBG_ExpectPointer(ADBG_Case_t *const Case_p,
+ const char *const FileName_p, const int LineNumber,
+ const void *Expected_p, const void *Got_p,
+ const char *const GotVarName_p);
+
+bool Do_ADBG_ExpectPointerNotNULL(ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber, const void *Got_p,
+ const char *const GotVarName_p);
+
+bool Do_ADBG_ExpectCompareSigned(ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber, const long Value1,
+ const long Value2, const bool Result,
+ const char *const Value1Str_p,
+ const char *const ComparStr_p,
+ const char *const Value2Str_p);
+
+bool Do_ADBG_ExpectCompareUnsigned(ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const unsigned long Value1,
+ const unsigned long Value2,
+ const bool Result,
+ const char *const Value1Str_p,
+ const char *const ComparStr_p,
+ const char *const Value2Str_p);
+
+bool Do_ADBG_ExpectComparePointer(ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const void *const Value1_p,
+ const void *const Value2_p, const bool Result,
+ const char *const Value1Str_p,
+ const char *const ComparStr_p,
+ const char *const Value2Str_p);
+
+const char *Do_ADBG_GetEnumName(const int Value,
+ const ADBG_EnumTable_t *const EnumTable_p);
+
+/**
+ * Returns the number of accumulated errors in the current
+ * subcase.
+ *
+ * @param Case_p Pointer to the running test case.
+ *
+ * @return The number of accumulated errors
+ */
+size_t Do_ADBG_GetNumberOfErrors(ADBG_Case_t *const Case_p);
+
+/*
+ * Log functions
+ */
+void Do_ADBG_FileSystemLog(const char *CmdBuf_p, const int *ArgIndex_p,
+ int ArgsFound);
+
+void Do_ADBG_StartLog(void);
+
+void Do_ADBG_PrintLog(bool UseNormalPrintf, uint32_t Delay);
+
+void Do_ADBG_DeleteLog(void);
+
+/**
+ * Writes a string to output.
+ * String length max is defined by ADBG_STRING_LENGTH_MAX
+ *
+ * @param Format_p The formatting string as in printf
+ */
+void Do_ADBG_Log(const char *const Format_p, ...)
+__attribute__((__format__(__printf__, 1, 2)));
+
+void Do_ADBG_LogHeading(unsigned Level, const char *const Format_p, ...)
+__attribute__((__format__(__printf__, 2, 3)));
+
+void Do_ADBG_LogText(const char *const Text_p);
+
+void Do_ADBG_LogHelp(const ADBG_HelpTable_t *const HelpTable_p,
+ const size_t HelpTableLength);
+
+void Do_ADBG_LogTable(const ADBG_LogTable_t *const TableRow_p,
+ const size_t NumColumns);
+void Do_ADBG_LogTableLine(const ADBG_LogTable_t *const TableRow_p,
+ const size_t NumColumns);
+
+void Do_ADBG_LogTableShapes(const ADBG_LogTableShapes_t *const Shapes,
+ const ADBG_LogTable_t *const TableRow_p,
+ const size_t NumColumns);
+void Do_ADBG_LogTableShapesLine(const ADBG_LogTableShapes_t *const Shapes,
+ const ADBG_LogTable_t *const TableRow_p,
+ const size_t NumColumns);
+
+/**
+ * Writes out the contents of buf_p formatted so that each line will
+ * have cols number of columns.
+ *
+ * @param[in] Buf_p Buffer to print
+ * @param[in] Size Size of buffer (in bytes)
+ * @param[in] Cols Number of columns.
+ */
+void Do_ADBG_HexLog(const void *const Buf_p, const size_t Size,
+ const size_t Cols);
+
+/*
+ * Suite functions
+ */
+
+/**
+ * Aborts the test suite after the current case has finished.
+ */
+void Do_ADBG_AbortSuite(ADBG_Case_t *const Case_p);
+
+#define ADBG_CASE_ABORT() (return)
+
+
+int Do_ADBG_RunSuite(const ADBG_Suite_Definition_t *Suite_p, int argc,
+ char *argv[]);
+
+void Do_ADBG_MTS_Suite(const ADBG_Suite_Definition_t *Suite_p, int argc,
+ char *argv[]);
+
+ADBG_SuiteData_t *Do_ADBG_GetSuiteData(const ADBG_Case_t *const Case_p);
+
+/*
+ * SubCase functions
+ */
+void Do_ADBG_BeginSubCase(ADBG_Case_t *const Case_p,
+ const char *const FormatTitle_p,
+ ...) __attribute__((__format__(__printf__, 2, 3)));
+
+void Do_ADBG_EndSubCase(ADBG_Case_t *const Case_p,
+ const char *const FormatTitle_p,
+ ...) __attribute__((__format__(__printf__, 2, 3)));
+
+#endif /* ADBG_H */
diff --git a/host/xtest/adbg/src/adbg_case.c b/host/xtest/adbg/src/adbg_case.c
new file mode 100644
index 0000000..3567d2e
--- /dev/null
+++ b/host/xtest/adbg/src/adbg_case.c
@@ -0,0 +1,406 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+* 1. Includes
+*************************************************************************/
+#include "adbg_int.h"
+
+/*************************************************************************
+* 2. Definition of external constants and variables
+*************************************************************************/
+
+/*************************************************************************
+* 3. File scope types, constants and variables
+*************************************************************************/
+
+/*************************************************************************
+* 4. Declaration of file local functions
+*************************************************************************/
+
+/*
+ * Deletes a subcase. Don't call this function before the
+ * subcase is removed from list.
+ */
+static void ADBG_SubCase_Delete(ADBG_SubCase_t *SubCase);
+
+static ADBG_SubCase_t *ADBG_Case_CreateSubCase(ADBG_Case_t *Case_p,
+ const char *const Title_p);
+
+static ADBG_SubCase_t *ADBG_Case_GetParentSubCase(ADBG_Case_t *Case_p,
+ ADBG_SubCase_t *SubCase_p);
+
+static const char *ADBG_Case_GetTestID(ADBG_Case_t *Case_p);
+
+/*************************************************************************
+* 5. Definition of external functions
+*************************************************************************/
+ADBG_Case_t *ADBG_Case_New(
+ const ADBG_Case_SuiteEntry_t *SuiteEntry_p,
+ ADBG_SuiteData_t *SuiteData_p
+ )
+{
+ ADBG_Case_t *Case_p;
+
+ Case_p = HEAP_ALLOC(ADBG_Case_t);
+ if (Case_p == NULL)
+ return NULL;
+
+ memset(Case_p, 0, sizeof(ADBG_Case_t));
+ Case_p->SuiteEntry_p = SuiteEntry_p;
+ Case_p->SuiteData_p = SuiteData_p;
+ return Case_p;
+}
+
+void ADBG_Case_Delete(
+ ADBG_Case_t *Case_p
+ )
+{
+ ADBG_SubCase_Delete(Case_p->FirstSubCase_p);
+ HEAP_FREE(&Case_p);
+}
+
+bool ADBG_Case_SubCaseIsMain(
+ const ADBG_Case_t *const Case_p,
+ const ADBG_SubCase_t *const SubCase_p
+ )
+{
+ IDENTIFIER_NOT_USED(Case_p)
+ return SubCase_p->Parent_p == NULL;
+}
+
+
+void ADBG_Case_IterateSubCase(
+ ADBG_Case_t *Case_p,
+ ADBG_SubCase_Iterator_t *Iterator_p
+ )
+{
+ Iterator_p->Case_p = Case_p;
+ Iterator_p->CurrentSubCase_p = NULL;
+}
+
+ADBG_SubCase_t *ADBG_Case_NextSubCase(
+ ADBG_SubCase_Iterator_t *Iterator_p
+ )
+{
+ ADBG_Case_t *Case_p = Iterator_p->Case_p;
+ ADBG_SubCase_t *SubCase_p = Iterator_p->CurrentSubCase_p;
+
+
+ /*
+ * Traverse the subcases depth first, that is:
+ * 1.1.1.1
+ * 1.1.1.2
+ * 1.1.1
+ * 1.1.2.1
+ * 1.1.2
+ * 1.1
+ * 1.2.1
+ * 1.2
+ * 1
+ */
+ if (SubCase_p == NULL) {
+ /* Find the first leaf */
+ SubCase_p = Case_p->FirstSubCase_p;
+ if (SubCase_p == NULL)
+ goto CleanupReturn;
+
+ while (!TAILQ_EMPTY(&SubCase_p->SubCasesList))
+ SubCase_p = TAILQ_FIRST(&SubCase_p->SubCasesList);
+ goto CleanupReturn;
+ }
+
+ /*
+ * Look for the next leaf belonging to the parent
+ */
+
+ if (SubCase_p->Parent_p == NULL) {
+ /* If parent is NULL this is the top
+ subcase and we're done */
+ SubCase_p = NULL;
+ goto CleanupReturn;
+ }
+
+ if (TAILQ_NEXT(SubCase_p, Link) == NULL) {
+ /* If this is the last subcase of the
+ parent move up to parent */
+ SubCase_p = SubCase_p->Parent_p;
+ goto CleanupReturn;
+ }
+
+ /*
+ * Find next leaf
+ */
+ SubCase_p = TAILQ_NEXT(SubCase_p, Link);
+ while (!TAILQ_EMPTY(&SubCase_p->SubCasesList))
+ SubCase_p = TAILQ_FIRST(&SubCase_p->SubCasesList);
+
+CleanupReturn:
+ Iterator_p->CurrentSubCase_p = SubCase_p;
+ return SubCase_p;
+}
+
+void Do_ADBG_BeginSubCase(
+ ADBG_Case_t *const Case_p,
+ const char *const FormatTitle_p, ...
+ )
+{
+ ADBG_SubCase_t *SubCase_p = NULL;
+
+ if (Case_p == NULL) {
+ Do_ADBG_Log("Do_ADBG_BeginSubCase: NULL Case_p!");
+ return;
+ }
+
+ if (FormatTitle_p == NULL) {
+ Do_ADBG_Log("Do_ADBG_BeginSubCase: NULL FormatTitle_p!");
+ return;
+ }
+
+ va_list ArgList;
+ char Title[80];
+
+ /*lint -save -e718 -e746 -e530 lint doesn't seem to know of va_start */
+ va_start(ArgList, FormatTitle_p);
+ /*lint -restore */
+ (void)ADBG_vsnprintf(Title, sizeof(Title), FormatTitle_p, ArgList);
+ va_end(ArgList);
+
+ SubCase_p = ADBG_Case_CreateSubCase(Case_p, Title);
+
+ if (SubCase_p == NULL) {
+ Do_ADBG_Log("Do_ADBG_BeginSubCase: HEAP_ALLOC failed");
+ return;
+ }
+
+
+ if (ADBG_Case_SubCaseIsMain(Case_p, SubCase_p)) {
+ /* Main SubCase */
+ Do_ADBG_Log(" ");
+ Do_ADBG_Log("* %s %s", SubCase_p->TestID_p, SubCase_p->Title_p);
+ } else {
+ Do_ADBG_Log("o %s %s", SubCase_p->TestID_p, SubCase_p->Title_p);
+ }
+}
+
+void Do_ADBG_EndSubCase(
+ ADBG_Case_t *const Case_p,
+ const char *const FormatTitle_p, ...
+ )
+{
+ va_list ArgList;
+ char Title[80];
+ ADBG_SubCase_t *SubCase_p = NULL;
+
+ if (Case_p == NULL) {
+ Do_ADBG_Log("Do_ADBG_EndSubCase: NULL Case_p!");
+ return;
+ }
+
+ if (FormatTitle_p == NULL) {
+ strcpy(Title, "NULL");
+ } else {
+ /*lint -save -e718 -e746 -e530 lint doesn't
+ seem to know of va_start */
+ va_start(ArgList, FormatTitle_p);
+ /*lint -restore */
+ (void)ADBG_vsnprintf(Title, sizeof(Title), FormatTitle_p,
+ ArgList);
+ va_end(ArgList);
+ }
+
+
+ SubCase_p = Case_p->CurrentSubCase_p;
+
+ if (SubCase_p == NULL) {
+ Do_ADBG_Log("Do_ADBG_EndSubCase: "
+ "Have no active SubCase, bailing out for title \"%s\"",
+ Title);
+ return;
+ }
+
+ if (FormatTitle_p != NULL && strcmp(SubCase_p->Title_p, Title) != 0) {
+ Do_ADBG_Log("Do_ADBG_EndSubCase: "
+ "Active SubCase \"%s\" doesn't match supplied title \"%s\"",
+ SubCase_p->Title_p, Title);
+ return;
+ }
+
+ if (ADBG_Case_SubCaseIsMain(Case_p, SubCase_p)) {
+ if (FormatTitle_p == NULL) {
+ /* To end the main subcase we require
+ a matching title */
+ Do_ADBG_Log("Do_ADBG_EndSubCase: "
+ "The main SubCase \"%s\" doesn't match supplied title \"%s\"",
+ SubCase_p->Title_p, Title);
+ return;
+ }
+ /*
+ * Ending the main subcase
+ * make a complete copy of the aggregated result.
+ */
+ Case_p->Result = SubCase_p->Result;
+ } else {
+ /*
+ * Ending a subcase,
+ * Aggregate results to parent.
+ */
+ ADBG_SubCase_t *Parent_p = SubCase_p->Parent_p;
+
+ Parent_p->Result.NumSubTests += SubCase_p->Result.NumTests +
+ SubCase_p->Result.NumSubTests;
+ Parent_p->Result.NumFailedSubTests +=
+ SubCase_p->Result.NumFailedTests +
+ SubCase_p->Result.
+ NumFailedSubTests;
+ Parent_p->Result.AbortTestSuite =
+ SubCase_p->Result.AbortTestSuite;
+ if (SubCase_p->Result.NumTests > 0 ||
+ SubCase_p->Result.NumSubTests > 0)
+ Parent_p->Result.NumFailedSubCases++;
+ }
+
+ /* Print a summary of the subcase result */
+ if (SubCase_p->Result.NumFailedTests > 0 ||
+ SubCase_p->Result.NumFailedSubTests > 0) {
+ Do_ADBG_Log(" %s FAILED", SubCase_p->TestID_p);
+ } else {
+ Do_ADBG_Log(" %s OK", SubCase_p->TestID_p);
+ }
+
+ /* Update current subcase to be the parent of this subcase */
+ Case_p->CurrentSubCase_p =
+ ADBG_Case_GetParentSubCase(Case_p, SubCase_p);
+}
+
+void Do_ADBG_AbortSuite(
+ ADBG_Case_t *const Case_p
+ )
+{
+ Case_p->Result.AbortTestSuite = true;
+}
+
+ADBG_SuiteData_t *Do_ADBG_GetSuiteData(const ADBG_Case_t *const Case_p)
+{
+ return Case_p->SuiteData_p;
+}
+
+
+
+/*************************************************************************
+* 6. Definition of internal functions
+*************************************************************************/
+static ADBG_SubCase_t *ADBG_Case_CreateSubCase(
+ ADBG_Case_t *Case_p,
+ const char *const Title_p
+ )
+{
+ ADBG_SubCase_t *SubCase_p;
+
+ SubCase_p = HEAP_ALLOC(ADBG_SubCase_t);
+ if (SubCase_p == NULL)
+ goto ErrorReturn;
+
+ memset(SubCase_p, 0, sizeof(ADBG_SubCase_t));
+ TAILQ_INIT(&SubCase_p->SubCasesList);
+
+ SubCase_p->Title_p = SECUTIL_HEAP_STRDUP(Title_p);
+ if (SubCase_p->Title_p == NULL)
+ goto ErrorReturn;
+
+ /* Set parent pointer needed "early" below. */
+ SubCase_p->Parent_p = Case_p->CurrentSubCase_p;
+
+ if (SubCase_p->Parent_p == NULL) {
+ /* Main SubCase */
+ SubCase_p->TestID_p =
+ SECUTIL_HEAP_STRDUP(ADBG_Case_GetTestID(Case_p));
+ if (SubCase_p->TestID_p == NULL)
+ goto ErrorReturn;
+
+ Case_p->FirstSubCase_p = SubCase_p;
+ } else {
+ ADBG_SubCase_t *Parent_p = SubCase_p->Parent_p;
+ char PrefixTitle[80];
+
+ /* Update parent SubCase */
+ Parent_p->Result.NumSubCases++;
+ /*
+ * XXX 081112 EJENWIK
+ * bug in snprintf when passing more
+ * than one argument to snprintf.
+ */
+ (void)ADBG_snprintf(PrefixTitle, sizeof(PrefixTitle),
+ "%s",
+ Parent_p->TestID_p);
+ (void)ADBG_snprintf(PrefixTitle + strlen(PrefixTitle),
+ sizeof(PrefixTitle) - strlen(PrefixTitle),
+ ".%d",
+ Parent_p->Result.NumSubCases);
+ SubCase_p->TestID_p = SECUTIL_HEAP_STRDUP(PrefixTitle);
+ if (SubCase_p->TestID_p == NULL)
+ goto ErrorReturn;
+
+ TAILQ_INSERT_TAIL(&Parent_p->SubCasesList, SubCase_p, Link);
+ }
+
+ Case_p->CurrentSubCase_p = SubCase_p;
+ return SubCase_p;
+
+ErrorReturn:
+ ADBG_SubCase_Delete(SubCase_p);
+ return NULL;
+}
+
+static void ADBG_SubCase_Delete(
+ ADBG_SubCase_t *SubCase_p
+ )
+{
+ if (SubCase_p != NULL) {
+ /*
+ * Note that Util_ListDestroy() checks
+ * if SubCase_p->SubCasesList_p
+ * is NULL.
+ */
+ while (true) {
+ ADBG_SubCase_t *s =
+ TAILQ_FIRST(&SubCase_p->SubCasesList);
+
+ if (s == NULL)
+ break;
+
+ TAILQ_REMOVE(&SubCase_p->SubCasesList, s, Link);
+ ADBG_SubCase_Delete(s);
+ }
+ HEAP_FREE(&SubCase_p->TestID_p);
+ HEAP_FREE(&SubCase_p->Title_p);
+ HEAP_FREE(&SubCase_p);
+ }
+}
+
+ADBG_SubCase_t *ADBG_Case_GetParentSubCase(
+ ADBG_Case_t *Case_p,
+ ADBG_SubCase_t *SubCase_p
+ )
+{
+ IDENTIFIER_NOT_USED(Case_p)
+ IDENTIFIER_NOT_USED(SubCase_p)
+ return SubCase_p->Parent_p;
+}
+
+static const char *ADBG_Case_GetTestID(ADBG_Case_t *Case_p)
+{
+ IDENTIFIER_NOT_USED(Case_p)
+
+ return Case_p->SuiteEntry_p->CaseDefinition_p->TestID_p;
+}
diff --git a/host/xtest/adbg/src/adbg_enum.c b/host/xtest/adbg/src/adbg_enum.c
new file mode 100644
index 0000000..8cb33f9
--- /dev/null
+++ b/host/xtest/adbg/src/adbg_enum.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+* 1. Includes
+*************************************************************************/
+#include "adbg_int.h"
+
+/*************************************************************************
+* 2. Definition of external constants and variables
+*************************************************************************/
+
+
+ADBG_ENUM_TABLE_DEFINE_BEGIN(Boolean)
+ADBG_ENUM_TABLE_ENTRY(false),
+ADBG_ENUM_TABLE_ENTRY(true)
+ADBG_ENUM_TABLE_DEFINE_END(Boolean);
+
+
+/*************************************************************************
+* 3. File scope types, constants and variables
+*************************************************************************/
+
+/*************************************************************************
+* 4. Declaration of file local functions
+*************************************************************************/
+
+/*************************************************************************
+* 5. Definition of external functions
+*************************************************************************/
+const char *Do_ADBG_GetEnumName(
+ const int Value,
+ const ADBG_EnumTable_t *const EnumTable_p
+ )
+{
+ const ADBG_EnumTable_t *Entry_p = EnumTable_p;
+
+ for (; Entry_p->Name_p != NULL; Entry_p++) {
+ if (Entry_p->Value == Value)
+ return Entry_p->Name_p;
+ }
+ return "<unresolvable enum name>";
+}
+
+
+/*************************************************************************
+* 6. Definition of internal functions
+*************************************************************************/
diff --git a/host/xtest/adbg/src/adbg_expect.c b/host/xtest/adbg/src/adbg_expect.c
new file mode 100644
index 0000000..bedfd5d
--- /dev/null
+++ b/host/xtest/adbg/src/adbg_expect.c
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+ * 1. Includes
+ ************************************************************************/
+#include "adbg_int.h"
+
+/*************************************************************************
+ * 2. Definition of external constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 3. File scope types, constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 4. Declaration of file local functions
+ ************************************************************************/
+
+static bool ADBG_AssertHelper(ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber, const bool ExpressionOK);
+
+static const char *ADBG_GetFileBase(const char *const FileName_p);
+
+/*************************************************************************
+ * 5. Definition of external functions
+ ************************************************************************/
+void Do_ADBG_Assert(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const bool ExpressionOK,
+ const char *const Format_p, ...
+ )
+{
+ char Buffer[ADBG_STRING_LENGTH_MAX];
+ va_list List;
+
+ if (ADBG_AssertHelper(Case_p, FileName_p, LineNumber, ExpressionOK))
+ return;
+
+ /*lint -save -e718 -e746 -e530 lint doesn't seem to know of va_start */
+ va_start(List, Format_p);
+ /*lint -restore */
+ (void)vsnprintf(Buffer, sizeof(Buffer), Format_p, List);
+ va_end(List);
+
+ Do_ADBG_Log("%s:%d: %s",
+ ADBG_GetFileBase(FileName_p), LineNumber, Buffer);
+}
+
+bool Do_ADBG_Expect(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const int Expected,
+ const int Got,
+ const char *const GotVarName_p,
+ const ADBG_EnumTable_t *const EnumTable_p
+ )
+{
+ if (ADBG_AssertHelper(Case_p, FileName_p, LineNumber, Expected == Got))
+ return true;
+
+ if (EnumTable_p != NULL) {
+ Do_ADBG_Log("%s:%d: %s has an unexpected value: 0x%x = %s, "
+ "expected 0x%x = %s",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ GotVarName_p,
+ Got, Do_ADBG_GetEnumName(Got, EnumTable_p),
+ Expected,
+ Do_ADBG_GetEnumName(Expected, EnumTable_p));
+ } else {
+ Do_ADBG_Log(
+ "%s:%d: %s has an unexpected value: 0x%x, expected 0x%x",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ GotVarName_p, Got, Expected);
+ }
+
+ return false;
+}
+
+bool Do_ADBG_ExpectNot(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const int NotExpected,
+ const int Got,
+ const char *const GotVarName_p,
+ const ADBG_EnumTable_t *const EnumTable_p
+ )
+{
+ if (ADBG_AssertHelper(Case_p, FileName_p, LineNumber, NotExpected !=
+ Got))
+ return true;
+
+ if (EnumTable_p != NULL) {
+ Do_ADBG_Log("%s:%d: %s has an unexpected value: 0x%x = %s, "
+ "expected 0x%x = %s",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ GotVarName_p,
+ Got, Do_ADBG_GetEnumName(Got, EnumTable_p),
+ NotExpected,
+ Do_ADBG_GetEnumName(NotExpected, EnumTable_p));
+ } else {
+ Do_ADBG_Log(
+ "%s:%d: %s has an unexpected value: 0x%zu, expected 0x%zu",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ GotVarName_p, (size_t)Got, (size_t)NotExpected);
+ }
+
+ return false;
+}
+
+bool Do_ADBG_ExpectBuffer(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const void *const ExpectedBuffer_p,
+ const size_t ExpectedBufferLength,
+ const char *const GotBufferName_p,
+ const void *const GotBuffer_p,
+ const char *const GotBufferLengthName_p,
+ const size_t GotBufferLength
+ )
+{
+ if (!ADBG_AssertHelper(Case_p, FileName_p, LineNumber,
+ ExpectedBufferLength == GotBufferLength)) {
+ Do_ADBG_Log(
+ "%s:%d: %s has an unexpected value: %zu, expected %zu",
+ ADBG_GetFileBase(
+ FileName_p), LineNumber,
+ GotBufferLengthName_p, GotBufferLength,
+ ExpectedBufferLength);
+ return false;
+ }
+
+ if (!ADBG_AssertHelper(Case_p, FileName_p, LineNumber,
+ memcmp(ExpectedBuffer_p, GotBuffer_p,
+ ExpectedBufferLength) == 0)) {
+ Do_ADBG_Log("%s:%d: %s has an unexpected content:",
+ ADBG_GetFileBase(
+ FileName_p), LineNumber, GotBufferName_p);
+ Do_ADBG_Log("Got");
+ Do_ADBG_HexLog(GotBuffer_p, GotBufferLength, 16);
+ Do_ADBG_Log("Expected");
+ Do_ADBG_HexLog(ExpectedBuffer_p, ExpectedBufferLength, 16);
+ return false;
+ }
+
+ return true;
+}
+
+bool Do_ADBG_ExpectPointer(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const void *Expected_p,
+ const void *Got_p,
+ const char *const GotVarName_p
+ )
+{
+ if (ADBG_AssertHelper(Case_p, FileName_p, LineNumber, Expected_p ==
+ Got_p))
+ return true;
+
+ Do_ADBG_Log("%s:%d: %s has an unexpected value: %p, expected %p",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ GotVarName_p, Got_p, Expected_p);
+
+ return false;
+}
+
+
+
+bool Do_ADBG_ExpectPointerNotNULL(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const void *Got_p,
+ const char *const GotVarName_p
+ )
+{
+ if (ADBG_AssertHelper(Case_p, FileName_p, LineNumber, Got_p != NULL))
+ return true;
+
+ Do_ADBG_Log("%s:%d: %s has an unexpected value: %p, expected not NULL",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ GotVarName_p, Got_p);
+
+ return false;
+}
+
+bool Do_ADBG_ExpectCompareSigned(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const long Value1,
+ const long Value2,
+ const bool Result,
+ const char *const Value1Str_p,
+ const char *const ComparStr_p,
+ const char *const Value2Str_p
+ )
+{
+ if (!ADBG_AssertHelper(Case_p, FileName_p, LineNumber, Result)) {
+ Do_ADBG_Log(
+ "%s:%d: Expression \"%s %s %s\" (%ld %s %ld) is false",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ Value1Str_p, ComparStr_p, Value2Str_p,
+ Value1, ComparStr_p, Value2);
+ }
+ return Result;
+}
+
+bool Do_ADBG_ExpectCompareUnsigned(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const unsigned long Value1,
+ const unsigned long Value2,
+ const bool Result,
+ const char *const Value1Str_p,
+ const char *const ComparStr_p,
+ const char *const Value2Str_p
+ )
+{
+ if (!ADBG_AssertHelper(Case_p, FileName_p, LineNumber, Result)) {
+ Do_ADBG_Log(
+ "%s:%d: Expression \"%s %s %s\" (%lu %s %lu) is false",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ Value1Str_p, ComparStr_p, Value2Str_p,
+ Value1, ComparStr_p, Value2);
+ }
+ return Result;
+}
+
+
+bool Do_ADBG_ExpectComparePointer(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const void *const Value1_p,
+ const void *const Value2_p,
+ const bool Result,
+ const char *const Value1Str_p,
+ const char *const ComparStr_p,
+ const char *const Value2Str_p
+ )
+{
+ if (!ADBG_AssertHelper(Case_p, FileName_p, LineNumber, Result)) {
+ Do_ADBG_Log(
+ "%s:%d: Expression \"%s %s %s\" (%p %s %p) is false",
+ ADBG_GetFileBase(FileName_p), LineNumber,
+ Value1Str_p, ComparStr_p, Value2Str_p,
+ Value1_p, ComparStr_p, Value2_p);
+ }
+ return Result;
+}
+
+
+
+size_t Do_ADBG_GetNumberOfErrors(ADBG_Case_t *const Case_p)
+{
+ return Case_p->CurrentSubCase_p->Result.NumFailedTests;
+}
+
+
+/*************************************************************************
+ * 6. Definitions of internal functions
+ ************************************************************************/
+static bool ADBG_AssertHelper(
+ ADBG_Case_t *const Case_p,
+ const char *const FileName_p,
+ const int LineNumber,
+ const bool ExpressionOK
+ )
+{
+ ADBG_SubCase_t *SubCase_p = Case_p->CurrentSubCase_p;
+
+ IDENTIFIER_NOT_USED(Case_p)
+
+ SubCase_p->Result.NumTests++;
+
+ if (!ExpressionOK) {
+ SubCase_p->Result.NumFailedTests++;
+ if (SubCase_p->Result.FirstFailedRow == 0) {
+ SubCase_p->Result.FirstFailedRow = LineNumber;
+ SubCase_p->Result.FirstFailedFile_p = ADBG_GetFileBase(
+ FileName_p);
+ }
+ }
+
+ return ExpressionOK;
+}
+
+static const char *ADBG_GetFileBase(const char *const FileName_p)
+{
+ const char *Ch_p = FileName_p;
+ const char *Base_p = FileName_p;
+
+ while (*Ch_p != '\0') {
+ if (*Ch_p == '\\')
+ Base_p = Ch_p + 1;
+
+ Ch_p++;
+ }
+
+ return Base_p;
+}
diff --git a/host/xtest/adbg/src/adbg_int.h b/host/xtest/adbg/src/adbg_int.h
new file mode 100644
index 0000000..f9099da
--- /dev/null
+++ b/host/xtest/adbg/src/adbg_int.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef ADBG_INT_H
+#define ADBG_INT_H
+#include <sys/queue.h>
+#include <sys/param.h>
+
+#include <adbg.h>
+
+#include "security_utils_hex.h"
+#include "security_utils_mem.h"
+
+#include <sys/queue.h>
+
+#include <string.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+
+/*************************************************************************
+* 2. Types, constants and external variables
+*************************************************************************/
+
+typedef struct ADBG_Result {
+ int NumTests;
+ int NumFailedTests;
+ int NumSubTests;
+ int NumFailedSubTests;
+ int NumSubCases;
+ int NumFailedSubCases;
+ int FirstFailedRow;
+ char const *FirstFailedFile_p;
+ bool AbortTestSuite;
+ const char *WhySkipped_p;
+} ADBG_Result_t;
+
+TAILQ_HEAD(ADBG_SubCaseHead, ADBG_SubCase);
+typedef struct ADBG_SubCaseHead ADBG_SubCaseHead_t;
+
+typedef struct ADBG_SubCase ADBG_SubCase_t;
+struct ADBG_SubCase {
+ char *TestID_p;
+ char *Title_p;
+ ADBG_Result_t Result;
+ ADBG_SubCase_t *Parent_p; /* The SubCase where this SubCase was added */
+ ADBG_SubCaseHead_t SubCasesList; /* SubCases created in this SubCase*/
+ TAILQ_ENTRY(ADBG_SubCase) Link;
+};
+
+/* Typedefed in t_adbg.h */
+struct ADBG_Case {
+ const ADBG_Case_SuiteEntry_t *SuiteEntry_p;
+
+ ADBG_SubCase_t *CurrentSubCase_p;
+ ADBG_SubCase_t *FirstSubCase_p;
+
+ ADBG_SuiteData_t *SuiteData_p;
+ ADBG_Result_t Result;
+ TAILQ_ENTRY(ADBG_Case) Link;
+};
+
+typedef struct {
+ ADBG_Case_t *Case_p;
+ ADBG_SubCase_t *CurrentSubCase_p;
+} ADBG_SubCase_Iterator_t;
+
+
+/*************************************************************************
+* 3. Functions
+*************************************************************************/
+void *ADBG_ListMemAllocFunction(size_t Length);
+void ADBG_ListMemFreeFunction(void *Memory_p);
+
+bool ADBG_Case_SubCaseIsMain(const ADBG_Case_t *const Case_p,
+ const ADBG_SubCase_t *const SubCase_p);
+
+void ADBG_Case_IterateSubCase(ADBG_Case_t *Case_p,
+ ADBG_SubCase_Iterator_t *Iterator_p);
+
+ADBG_SubCase_t *ADBG_Case_NextSubCase(ADBG_SubCase_Iterator_t *Iterator_p);
+
+ADBG_Case_t *ADBG_Case_New(const ADBG_Case_SuiteEntry_t *SuiteEntry_p,
+ ADBG_SuiteData_t *SuiteData_p);
+
+void ADBG_Case_Delete(ADBG_Case_t *Case_p);
+
+int ADBG_snprintf(char *Buffer_p, size_t BufferSize, const char *Format_p,
+ ...) __attribute__((__format__(__printf__, 3, 4)));
+
+int ADBG_vsnprintf(char *Buffer_p, size_t BufferSize, const char *Format_p,
+ va_list List) __attribute__((__format__(__printf__, 3, 0)));
+
+bool ADBG_TestIDMatches(const char *const TestID_p,
+ const char *const Argument_p);
+
+#define HEAP_ALLOC(x) ((x *)malloc(sizeof(x)))
+#define HEAP_UNTYPED_ALLOC(x) malloc((x))
+#define HEAP_FREE(x) do { if (*(x) != NULL) { free(*(x)); *(x) = NULL; \
+ } } while (0)
+
+#define IDENTIFIER_NOT_USED(x) { if (sizeof(&x)) {} }
+
+#endif /* ADBG_INT_H */
diff --git a/host/xtest/adbg/src/adbg_log.c b/host/xtest/adbg/src/adbg_log.c
new file mode 100644
index 0000000..034d571
--- /dev/null
+++ b/host/xtest/adbg/src/adbg_log.c
@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "adbg_int.h"
+
+#include <stdlib.h>
+
+#include <ctype.h>
+/*************************************************************************
+ * 2. Definition of external constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 3. File scope types, constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 4. Declaration of file local functions
+ ************************************************************************/
+
+/*************************************************************************
+ * 5. Definition of external functions
+ ************************************************************************/
+
+/******************************************************************************/
+/*! @fn void Do_ADBG_Log( void* This_p, char* Format, ...)
+ * @brief
+ * @param [in] This_p
+ * @param [in] Format
+ * @param [in] ...
+ * @return void
+ */
+/******************************************************************************/
+void Do_ADBG_Log(const char *const Format, ...)
+{
+ va_list ap;
+ char buf[ADBG_STRING_LENGTH_MAX];
+
+ va_start(ap, Format);
+ vsnprintf(buf, sizeof(buf), Format, ap);
+ va_end(ap);
+ printf("%s\n", buf);
+}
+
+void Do_ADBG_LogHeading(unsigned Level, const char *const Format, ...)
+{
+ va_list List;
+ char String[ADBG_STRING_LENGTH_MAX];
+ char UnderLine;
+ char Numbers[10];
+ static int HeadingNumbers[3] = { 0, 0, 0 };
+
+/* lint -save -e718 -e746 -e530 lint doesn't seem to know of va_start */
+ va_start(List, Format);
+/* lint -restore */
+ (void)vsnprintf(String, sizeof(String), Format, List);
+ va_end(List);
+
+ switch (Level) {
+ case 0:
+ UnderLine = '#';
+ HeadingNumbers[0] = HeadingNumbers[1] = HeadingNumbers[2] = 0;
+ Numbers[0] = '\0';
+ break;
+ case 1:
+ UnderLine = '=';
+ HeadingNumbers[0]++;
+ HeadingNumbers[1] = HeadingNumbers[2] = 0;
+ (void)ADBG_snprintf(Numbers, sizeof(Numbers), "%d",
+ HeadingNumbers[0]);
+ break;
+ case 2:
+ UnderLine = '~';
+ HeadingNumbers[1]++;
+ HeadingNumbers[2] = 0;
+#if 0 /* Stupid snprintf bug only taking first argument */
+ (void)ADBG_snprintf(Numbers, sizeof(Numbers), "%d.%d",
+ HeadingNumbers[0], HeadingNumbers[1]);
+#else
+ (void)ADBG_snprintf(Numbers, sizeof(Numbers), "%d.",
+ HeadingNumbers[0]);
+ (void)ADBG_snprintf(Numbers + strlen(Numbers),
+ sizeof(Numbers) - strlen(Numbers),
+ "%d", HeadingNumbers[1]);
+#endif
+ break;
+ case 3:
+ UnderLine = '-';
+ HeadingNumbers[2]++;
+#if 0 /* Stupid snprintf bug only taking first argument */
+ (void)ADBG_snprintf(Numbers, sizeof(Numbers), "%d.%d.%d",
+ HeadingNumbers[0], HeadingNumbers[1],
+ HeadingNumbers[2]);
+#else
+ (void)ADBG_snprintf(Numbers, sizeof(Numbers), "%d.",
+ HeadingNumbers[0]);
+ (void)ADBG_snprintf(Numbers + strlen(Numbers),
+ sizeof(Numbers) - strlen(Numbers),
+ "%d.", HeadingNumbers[1]);
+ (void)ADBG_snprintf(Numbers + strlen(Numbers),
+ sizeof(Numbers) - strlen(Numbers),
+ "%d", HeadingNumbers[2]);
+#endif
+ break;
+ default:
+ UnderLine = '-';
+ Numbers[0] = '\0';
+ }
+
+ Do_ADBG_Log("%-5s %s", Numbers, String);
+
+ if (String[0] != '\0') {
+ size_t n;
+
+ for (n = 0; String[n] != '\0'; n++)
+ String[n] = UnderLine;
+
+ Do_ADBG_Log("%-5s %s", "", String);
+ if (Level == 0)
+ Do_ADBG_Log(" ");
+ }
+}
+
+void Do_ADBG_LogText(const char *const Text_p)
+{
+ static const ADBG_LogTableShapes_t Shapes = { ' ', ' ', ' ' };
+ ADBG_LogTable_t LogTable[2] = { { 3, NULL }, { 74, NULL } };
+
+ LogTable[1].Text_p = Text_p;
+ Do_ADBG_LogTableShapes(&Shapes, LogTable, 2);
+}
+
+void Do_ADBG_LogHelp(
+ const ADBG_HelpTable_t *const HelpTable_p,
+ const size_t HelpTableLength
+ )
+{
+ static const ADBG_LogTableShapes_t Shapes = { ' ', ' ', ' ' };
+ ADBG_LogTable_t Row[2] = { { 20, NULL }, { 50, NULL } };
+ size_t n;
+
+ for (n = 0; n < HelpTableLength; n++) {
+ Row[0].Text_p = HelpTable_p[n].Command_p;
+ Row[1].Text_p = HelpTable_p[n].Help_p;
+ Do_ADBG_LogTableShapes(&Shapes, Row, 2);
+ }
+}
+
+void Do_ADBG_HexLog(
+ const void *const Buf_p,
+ const size_t Size,
+ const size_t Cols
+ )
+{
+ const uint8_t *Data_p = Buf_p;
+ size_t n;
+
+ for (n = 0; n < Size; n += Cols) {
+ char HexBuffer[ADBG_STRING_LENGTH_MAX];
+ char AsciiBuffer[ADBG_STRING_LENGTH_MAX / 3];
+ size_t m, NumCols;
+
+ (void)SecUtil_BufferToHex(Data_p + n, MIN(Cols, Size - n), NULL,
+ HexBuffer, sizeof(HexBuffer));
+ NumCols = MIN(MIN(Cols, Size - n), sizeof(AsciiBuffer) - 1);
+ for (m = 0; m < NumCols; m++) {
+ int ch = Data_p[n + m];
+
+ if (isprint(ch))
+ AsciiBuffer[m] = (char)ch;
+ else
+ AsciiBuffer[m] = '.';
+ }
+ AsciiBuffer[m] = '\0';
+
+ Do_ADBG_Log(" %-*s %s", (int)Cols * 3, HexBuffer, AsciiBuffer);
+ }
+}
+
+void Do_ADBG_LogTable(
+ const ADBG_LogTable_t *const TableRow_p,
+ const size_t NumColumns
+ )
+{
+ const ADBG_LogTableShapes_t Shapes = { '+', '|', '-' };
+
+ Do_ADBG_LogTableShapes(&Shapes, TableRow_p, NumColumns);
+}
+
+void Do_ADBG_LogTableLine(
+ const ADBG_LogTable_t *const TableRow_p,
+ const size_t NumColumns
+ )
+{
+ const ADBG_LogTableShapes_t Shapes = { '+', '|', '-' };
+
+ Do_ADBG_LogTableShapesLine(&Shapes, TableRow_p, NumColumns);
+}
+
+
+void Do_ADBG_LogTableShapes(
+ const ADBG_LogTableShapes_t *const Shapes,
+ const ADBG_LogTable_t *const TableRow_p,
+ const size_t NumColumns
+ )
+{
+ char *Line_p;
+ size_t *LastPos_p;
+ size_t n;
+ size_t TableColumn;
+ size_t LinePosition;
+ size_t LineLength;
+ size_t NumColumnsLeft;
+
+ LineLength = 2; /* Starting and ending '|' */
+ for (n = 0; n < NumColumns; n++)
+ LineLength += TableRow_p[n].ColumnWidth + 1; /* One extra '|' */
+
+ Line_p = HEAP_UNTYPED_ALLOC(LineLength + 1);
+ LastPos_p = HEAP_UNTYPED_ALLOC(sizeof(size_t) * NumColumns);
+ if (Line_p == NULL || LastPos_p == NULL) {
+ Do_ADBG_Log("Do_ADBG_LogTableLine: Memory allocation failed");
+ goto CleanupReturn;
+ }
+ memset(LastPos_p, 0, sizeof(size_t) * NumColumns);
+
+ do {
+ NumColumnsLeft = NumColumns;
+ LinePosition = 0;
+ for (TableColumn = 0; TableColumn < NumColumns; TableColumn++) {
+ const ADBG_LogTable_t *Col_p = TableRow_p + TableColumn;
+ size_t TextLen = 0;
+ size_t ColumnPos;
+
+ if (Col_p->Text_p != NULL)
+ TextLen = strlen(Col_p->Text_p);
+
+ Line_p[LinePosition] = Shapes->Vertical;
+ LinePosition++;
+
+ if (Col_p->ColumnWidth <= 1) {
+ NumColumnsLeft--;
+ continue;
+ }
+
+ Line_p[LinePosition] = ' ';
+ LinePosition++;
+
+ if (Col_p->ColumnWidth <= 2) {
+ NumColumnsLeft--;
+ continue;
+ }
+
+ n = LastPos_p[TableColumn];
+ ColumnPos = 1;
+ while (n < TextLen && ColumnPos < Col_p->ColumnWidth) {
+ size_t WordLength;
+ size_t NewLine = 0;
+
+ /*
+ * We copy one complete word at a time.
+ * If the word is too long
+ * to fit in the column at all
+ * it's broken at the end of the
+ * column.
+ */
+
+ /* Consume leading spaces */
+ while (n < TextLen && Col_p->Text_p[n] == ' ')
+ n++;
+
+ /* Find out the length of the word */
+ WordLength = 0;
+ while ((n + WordLength) < TextLen &&
+ Col_p->Text_p[n + WordLength] != ' ') {
+ if (Col_p->Text_p[n + WordLength] ==
+ '\n') {
+ NewLine = 1;
+ break;
+ }
+ /*
+ * The -1 for ColumnWidth is
+ * to make room for a final space
+ * before the '|'.
+ */
+ if ((ColumnPos + WordLength) >=
+ (Col_p->ColumnWidth - 1)) {
+ if (ColumnPos != 1) {
+ /* Save this word
+ for the next line */
+ WordLength = 0;
+ }
+ break;
+ }
+ WordLength++;
+ }
+
+ /* Copy the word and update the positions */
+ memcpy(Line_p + LinePosition, Col_p->Text_p + n,
+ WordLength);
+ n += WordLength + NewLine;
+ LinePosition += WordLength;
+ ColumnPos += WordLength;
+
+ /* Now output all spaces */
+
+ if (WordLength == 0) {
+ /* The spaces will be added
+ in the outer loop */
+ break;
+ }
+
+ /*
+ * If there's spaces in the text at the
+ * current position
+ * and there's room for one, output one space.
+ * The rest of the spaces are consumed in
+ * the inner loop
+ * above. This will take an additional line if
+ * the spaces
+ * are at the end of the Text_p but you're not
+ * supposed end a Text_p with spaces any way.
+ */
+ if (Col_p->Text_p[n] == ' ' && ColumnPos <
+ Col_p->ColumnWidth) {
+ Line_p[LinePosition] = ' ';
+ LinePosition++;
+ ColumnPos++;
+ n++;
+ }
+ }
+ LastPos_p[TableColumn] = n;
+
+ if (LastPos_p[TableColumn] == TextLen)
+ NumColumnsLeft--;
+
+ /* Output spaces until the end of the column */
+ while (ColumnPos < Col_p->ColumnWidth) {
+ Line_p[LinePosition] = ' ';
+ LinePosition++;
+ ColumnPos++;
+ }
+ }
+
+ Line_p[LinePosition] = Shapes->Vertical;
+ LinePosition++;
+ Line_p[LinePosition] = '\0';
+ Do_ADBG_Log("%s", Line_p);
+ } while (NumColumnsLeft > 0);
+
+CleanupReturn:
+ HEAP_FREE(&Line_p);
+ HEAP_FREE(&LastPos_p);
+}
+
+void Do_ADBG_LogTableShapesLine(
+ const ADBG_LogTableShapes_t *const Shapes,
+ const ADBG_LogTable_t *const TableRow_p,
+ const size_t NumColumns
+ )
+{
+ char *Line_p;
+ size_t n;
+ size_t TableColumn;
+ size_t LinePosition;
+ size_t LineLength;
+
+ LineLength = 2; /* Starting and ending '+' */
+ for (n = 0; n < NumColumns; n++)
+ LineLength += TableRow_p[n].ColumnWidth + 1; /* One extra '+' */
+
+ Line_p = HEAP_UNTYPED_ALLOC(LineLength + 1);
+ if (Line_p == NULL) {
+ Do_ADBG_Log("Do_ADBG_LogTableLine: Memory allocation failed");
+ goto CleanupReturn;
+ }
+
+ LinePosition = 0;
+ for (TableColumn = 0; TableColumn < NumColumns; TableColumn++) {
+ Line_p[LinePosition] = Shapes->Corner;
+ LinePosition++;
+ for (n = 0; n < TableRow_p[TableColumn].ColumnWidth; n++) {
+ Line_p[LinePosition] = Shapes->Horizontal;
+ LinePosition++;
+ }
+ }
+ Line_p[LinePosition] = Shapes->Corner;
+ LinePosition++;
+ Line_p[LinePosition] = '\0';
+ Do_ADBG_Log("%s", Line_p);
+
+CleanupReturn:
+ HEAP_FREE(&Line_p);
+}
+
+/*************************************************************************
+ * 6. Definitions of internal functions
+ ************************************************************************/
diff --git a/host/xtest/adbg/src/adbg_mts.c b/host/xtest/adbg/src/adbg_mts.c
new file mode 100644
index 0000000..029a3a3
--- /dev/null
+++ b/host/xtest/adbg/src/adbg_mts.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+ * 1. Includes
+ ************************************************************************/
+#include "adbg_int.h"
+
+/*************************************************************************
+ * 2. Definition of external constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 3. File scope types, constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 4. Declaration of file local functions
+ ************************************************************************/
+
+/*************************************************************************
+ * 5. Definition of external functions
+ ************************************************************************/
+void Do_ADBG_MTS_Suite(
+ const ADBG_Suite_Definition_t *Suite_p,
+ int argc,
+ char *argv[]
+ )
+{
+ const ADBG_Case_Definition_t *CaseDefinition_p;
+ char *Argument_p = NULL;
+ size_t n;
+ ADBG_LogTable_t LogTable[3] = {
+ { 11, NULL }, { 52, NULL }, { 13, NULL } };
+
+ if (argc > 1)
+ Argument_p = argv[1];
+
+ /* Title of MTS */
+ Do_ADBG_LogHeading(0, "%s module test specification",
+ Suite_p->SuiteID_p);
+
+ Do_ADBG_LogHeading(1, "Description of the test cases");
+
+ /* Horizontal line for three columns */
+ Do_ADBG_LogTableLine(LogTable, 3);
+
+ /* Description of each column */
+ LogTable[0].Text_p = "Test CaseID";
+ LogTable[1].Text_p = "Short Description";
+ LogTable[2].Text_p = "Requirement IDs";
+ Do_ADBG_LogTable(LogTable, 3);
+
+ /* Horizontal line for three columns */
+ Do_ADBG_LogTableLine(LogTable, 3);
+
+ for (n = 0; Suite_p->SuiteEntries_p[n].CaseDefinition_p != NULL; n++) {
+ CaseDefinition_p = Suite_p->SuiteEntries_p[n].CaseDefinition_p;
+
+ if (Argument_p != NULL &&
+ !ADBG_TestIDMatches(CaseDefinition_p->TestID_p,
+ Argument_p)) {
+ continue;
+ }
+
+ /* Print the three columns of a test case */
+ LogTable[0].Text_p = CaseDefinition_p->TestID_p;
+ LogTable[1].Text_p = CaseDefinition_p->ShortDescription_p;
+ LogTable[2].Text_p = CaseDefinition_p->RequirementIDs_p;
+ Do_ADBG_LogTable(LogTable, 3);
+
+ /* Horizontal line for three columns */
+ Do_ADBG_LogTableLine(LogTable, 3);
+ }
+
+
+ Do_ADBG_Log(" ");
+ Do_ADBG_LogHeading(1, "Detailed description of each test case");
+
+ for (n = 0; Suite_p->SuiteEntries_p[n].CaseDefinition_p != NULL; n++) {
+ CaseDefinition_p = Suite_p->SuiteEntries_p[n].CaseDefinition_p;
+
+ if (Argument_p != NULL &&
+ !ADBG_TestIDMatches(CaseDefinition_p->TestID_p,
+ Argument_p)) {
+ continue;
+ }
+
+ Do_ADBG_LogHeading(2, "%s %s",
+ CaseDefinition_p->TestID_p,
+ CaseDefinition_p->Title_p);
+ if (Suite_p->SuiteEntries_p[n].WhyDisabled_p != NULL) {
+ Do_ADBG_LogText("This test was disabled because:");
+ Do_ADBG_LogText(
+ Suite_p->SuiteEntries_p[n].WhyDisabled_p);
+ Do_ADBG_Log(" ");
+ }
+ Do_ADBG_LogText("Objective:");
+ Do_ADBG_LogText(CaseDefinition_p->ShortDescription_p);
+ Do_ADBG_Log(" ");
+ Do_ADBG_LogText("Implementation:");
+ Do_ADBG_LogText(CaseDefinition_p->HowToImplement_p);
+ Do_ADBG_Log(" ");
+ }
+}
+
+/*************************************************************************
+ * 6. Definitions of internal functions
+ ************************************************************************/
diff --git a/host/xtest/adbg/src/adbg_run.c b/host/xtest/adbg/src/adbg_run.c
new file mode 100644
index 0000000..5d61639
--- /dev/null
+++ b/host/xtest/adbg/src/adbg_run.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+ * 1. Includes
+ ************************************************************************/
+#include "adbg_int.h"
+
+/*************************************************************************
+ * 2. Definition of external constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 3. File scope types, constants and variables
+ ************************************************************************/
+
+TAILQ_HEAD(ADBG_CaseHead, ADBG_Case);
+typedef struct ADBG_CaseHead ADBG_CaseHead_t;
+
+typedef struct ADBG_Runner {
+ ADBG_Result_t Result;
+ const ADBG_Suite_Definition_t *Suite_p;
+
+ ADBG_SuiteData_t SuiteData;
+ ADBG_CaseHead_t CasesList;
+} ADBG_Runner_t;
+
+/*************************************************************************
+ * 4. Declaration of file local functions
+ ************************************************************************/
+
+static int ADBG_RunSuite(ADBG_Runner_t *Runner_p, int argc, char *argv[]);
+
+
+/*************************************************************************
+ * 5. Definition of external functions
+ ************************************************************************/
+int Do_ADBG_RunSuite(
+ const ADBG_Suite_Definition_t *Suite_p,
+ int argc,
+ char *argv[]
+ )
+{
+ ADBG_Runner_t *Runner_p;
+
+ Runner_p = HEAP_ALLOC(ADBG_Runner_t);
+ if (Runner_p == NULL) {
+ Do_ADBG_Log("HEAP_ALLOC failed for Suite %s!",
+ Suite_p->SuiteID_p);
+ return -1;
+ }
+ memset(Runner_p, 0, sizeof(ADBG_Runner_t));
+ TAILQ_INIT(&Runner_p->CasesList);
+ Runner_p->Suite_p = Suite_p;
+
+ int ret = ADBG_RunSuite(Runner_p, argc, argv);
+ HEAP_FREE(&Runner_p);
+ return ret;
+}
+
+/*************************************************************************
+ * 6. Definitions of internal functions
+ ************************************************************************/
+static int ADBG_RunSuite(
+ ADBG_Runner_t *Runner_p,
+ int argc,
+ char *argv[]
+ )
+{
+ size_t n;
+ ADBG_Case_t *Case_p;
+ size_t NumSkippedTestCases = 0;
+ int failed_test = 0;
+
+ Do_ADBG_Log("######################################################");
+ Do_ADBG_Log("#");
+ Do_ADBG_Log("# %s", Runner_p->Suite_p->SuiteID_p);
+ Do_ADBG_Log("#");
+ Do_ADBG_Log("######################################################");
+
+ for (n = 0;
+ Runner_p->Suite_p->SuiteEntries_p[n].CaseDefinition_p != NULL;
+ n++) {
+ const ADBG_Case_SuiteEntry_t *SuiteEntry_p =
+ &Runner_p->Suite_p->SuiteEntries_p[n];
+ if (argc > 0) {
+ bool HaveMatch = false;
+ int i;
+
+ for (i = 0; i < argc; i++) {
+ if (ADBG_TestIDMatches(SuiteEntry_p->
+ CaseDefinition_p->
+ TestID_p,
+ argv[i])) {
+ HaveMatch = true;
+ break;
+ }
+ }
+ if (!HaveMatch) {
+ NumSkippedTestCases++;
+ continue;
+ }
+ }
+
+ Case_p = ADBG_Case_New(SuiteEntry_p, &Runner_p->SuiteData);
+ if (Case_p == NULL) {
+ Do_ADBG_Log("HEAP_ALLOC failed for Case %s!",
+ SuiteEntry_p->CaseDefinition_p->TestID_p);
+ Runner_p->Result.AbortTestSuite = 1;
+ break;
+ }
+
+ TAILQ_INSERT_TAIL(&Runner_p->CasesList, Case_p, Link);
+
+ /* Start the parent test case */
+ Do_ADBG_BeginSubCase(Case_p, "%s",
+ SuiteEntry_p->CaseDefinition_p->Title_p);
+
+ if (SuiteEntry_p->WhyDisabled_p == NULL) {
+ /* Run case */
+ SuiteEntry_p->CaseDefinition_p->Run_fp(Case_p);
+ } else {
+ NumSkippedTestCases++;
+ }
+
+ /* End abondoned subcases */
+ while (Case_p->CurrentSubCase_p != Case_p->FirstSubCase_p)
+ Do_ADBG_EndSubCase(Case_p, NULL);
+
+ /* End the parent test case */
+ Do_ADBG_EndSubCase(Case_p, "%s",
+ SuiteEntry_p->CaseDefinition_p->Title_p);
+
+ /* Sum up the errors */
+ Case_p->Result.WhySkipped_p = SuiteEntry_p->WhyDisabled_p;
+ Runner_p->Result.NumTests += Case_p->Result.NumTests +
+ Case_p->Result.NumSubTests;
+ Runner_p->Result.NumFailedTests +=
+ Case_p->Result.NumFailedTests +
+ Case_p->Result.
+ NumFailedSubTests;
+ Runner_p->Result.NumSubCases++;
+ if (Case_p->Result.NumFailedTests +
+ Case_p->Result.NumFailedSubTests > 0)
+ Runner_p->Result.NumFailedSubCases++;
+
+ Runner_p->Result.AbortTestSuite = Case_p->Result.AbortTestSuite;
+
+ if (Runner_p->Result.AbortTestSuite) {
+ Do_ADBG_Log("Test suite aborted by %s!",
+ SuiteEntry_p->CaseDefinition_p->TestID_p);
+ break;
+ }
+ }
+
+ if (Runner_p->Suite_p->CleanupSuite_fp != NULL)
+ Runner_p->Suite_p->CleanupSuite_fp(&Runner_p->SuiteData);
+
+ Do_ADBG_Log("+-----------------------------------------------------");
+ if (argc > 0) {
+ int i;
+
+ for (i = 0; i < argc; i++)
+ Do_ADBG_Log(
+ "Result of testsuite %s filtered by \"%s\":",
+ Runner_p->Suite_p->SuiteID_p, argv[i]);
+ } else {
+ Do_ADBG_Log("Result of testsuite %s:",
+ Runner_p->Suite_p->SuiteID_p);
+ }
+
+ TAILQ_FOREACH(Case_p, &Runner_p->CasesList, Link) {
+ ADBG_SubCase_Iterator_t Iterator;
+ ADBG_SubCase_t *SubCase_p;
+
+ ADBG_Case_IterateSubCase(Case_p, &Iterator);
+ while ((SubCase_p = ADBG_Case_NextSubCase(&Iterator)) != NULL) {
+ if (Case_p->Result.WhySkipped_p != NULL) {
+ Do_ADBG_Log("%s SKIPPED: \"%s\"",
+ SubCase_p->TestID_p,
+ Case_p->Result.WhySkipped_p);
+ } else if (SubCase_p->Result.NumFailedTests +
+ SubCase_p->Result.NumFailedSubTests > 0) {
+ if (SubCase_p->Result.FirstFailedFile_p !=
+ NULL) {
+ Do_ADBG_Log(
+ "%s FAILED first error at %s:%d",
+ SubCase_p->TestID_p,
+ SubCase_p->
+ Result.FirstFailedFile_p,
+ SubCase_p->
+ Result.FirstFailedRow);
+ } else {
+ Do_ADBG_Log("%s FAILED",
+ SubCase_p->TestID_p);
+ }
+ } else if (ADBG_Case_SubCaseIsMain(Case_p, SubCase_p)) {
+ /* A level one test case is displayed
+ if successfull too */
+ Do_ADBG_Log("%s OK", SubCase_p->TestID_p);
+ }
+ }
+ }
+
+
+ Do_ADBG_Log("+-----------------------------------------------------");
+ if (Runner_p->Result.AbortTestSuite)
+ Do_ADBG_Log("Test suite was ABORTED");
+
+ Do_ADBG_Log("%d subtest%s of which %d failed",
+ Runner_p->Result.NumTests,
+ Runner_p->Result.NumTests > 1 ? "s" : "",
+ Runner_p->Result.NumFailedTests);
+ Do_ADBG_Log("%d test case%s of which %d failed",
+ Runner_p->Result.NumSubCases,
+ Runner_p->Result.NumSubCases > 1 ? "s" : "",
+ Runner_p->Result.NumFailedSubCases);
+ Do_ADBG_Log("%zu test case%s was skipped",
+ NumSkippedTestCases,
+ NumSkippedTestCases > 1 ? "s" : "");
+
+ failed_test = Runner_p->Result.NumFailedSubCases;
+
+ while (true) {
+ Case_p = TAILQ_FIRST(&Runner_p->CasesList);
+ if (Case_p == NULL)
+ break;
+ TAILQ_REMOVE(&Runner_p->CasesList, Case_p, Link);
+ ADBG_Case_Delete(Case_p);
+ }
+ return failed_test;
+}
diff --git a/host/xtest/adbg/src/adbg_util.c b/host/xtest/adbg/src/adbg_util.c
new file mode 100644
index 0000000..0d29a74
--- /dev/null
+++ b/host/xtest/adbg/src/adbg_util.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+ * 1. Includes
+ ************************************************************************/
+#include "adbg_int.h"
+
+/*************************************************************************
+ * 2. Definition of external constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 3. File scope types, constants and variables
+ ************************************************************************/
+
+/*************************************************************************
+ * 4. Declaration of file local functions
+ ************************************************************************/
+
+/*************************************************************************
+ * 5. Definition of external functions
+ ************************************************************************/
+bool ADBG_TestIDMatches(
+ const char *const TestID_p,
+ const char *const Argument_p
+ )
+{
+ if (Argument_p == NULL)
+ return false;
+
+ return strstr(TestID_p, Argument_p) != NULL;
+}
+
+void *ADBG_ListMemAllocFunction(size_t Length)
+{
+ return HEAP_UNTYPED_ALLOC(Length);
+}
+
+void ADBG_ListMemFreeFunction(void *Memory_p)
+{
+ void *p = Memory_p;
+
+ HEAP_FREE(&p);
+}
+
+int ADBG_snprintf(
+ char *Buffer_p,
+ size_t BufferSize,
+ const char *Format_p,
+ ...
+ )
+{
+ va_list List;
+ int ReturnValue;
+
+ /*lint -save -e718 -e746 -e530 lint doesn't seem to know of va_start */
+ va_start(List, Format_p);
+ /*lint -restore */
+ ReturnValue = ADBG_vsnprintf(Buffer_p, BufferSize, Format_p, List);
+ va_end(List);
+ return ReturnValue;
+}
+
+int ADBG_vsnprintf(
+ char *Buffer_p,
+ size_t BufferSize,
+ const char *Format_p,
+ va_list List
+ )
+{
+ int Length;
+
+ Length = vsnprintf(Buffer_p, BufferSize, Format_p, List);
+
+ /*
+ * The moses version of vsnprintf() doesn't seem to add
+ * a terminating zero to the string if the result is too
+ * large.
+ */
+ if (Buffer_p != NULL && BufferSize > 0)
+ Buffer_p[BufferSize - 1] = '\0';
+
+ return Length;
+}
+
+/*************************************************************************
+ * 6. Definitions of internal functions
+ ************************************************************************/
diff --git a/host/xtest/adbg/src/r_list.h b/host/xtest/adbg/src/r_list.h
new file mode 100644
index 0000000..1f2bafb
--- /dev/null
+++ b/host/xtest/adbg/src/r_list.h
@@ -0,0 +1,1066 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef INCLUSION_GUARD_R_LIST_H
+#define INCLUSION_GUARD_R_LIST_H
+
+/*************************************************************************
+**************************************************************************
+*
+* DESCRIPTION:
+*
+* Header file containing the function prototypes for the doubly linked list
+* function category
+*
+*************************************************************************/
+
+#include <stdbool.h>
+#include "t_list.h"
+
+#define xmalloc malloc
+#define xfree free
+
+
+/** AUTOGEN_SWBP_FUNCTION_NOT_FOUND_IN_REFERENCE_MANUAL */
+bool ListStrComparisonFunc(const void *AnElementKey_p,
+ const void *KeyToMatch_p);
+
+#define Util_ListInsertBefore(a, b, c) \
+ Util_EListInsertBefore((a), (void *)(b), \
+ (c))
+#define Util_ListInsertAfter(a, b, c) \
+ Util_EListInsertAfter((a), (void *)(b), \
+ (c))
+#define Util_ListMatchingKey(a, b) \
+ Util_EListMatchingKey((a), (void *)(b), \
+ ListStrComparisonFunc)
+#define Util_ListCreate() \
+ Util_EListCreate(xmalloc, xfree)
+
+/* These structure are not public. They are included here
+ * to allow for macro
+ * definition (see the macros at the end of the file) */
+
+struct LListItem {
+ struct LListItem *Prev_p;
+ struct LListItem *Next_p;
+ void *Body_p;
+ const void *EKey_p;
+};
+
+struct DL_List {
+ uint16_t NbrOfElements; /* Number of elements
+ in the linked list */
+ ListItem_t *Head_p; /* first item in the list */
+ ListItem_t *Tail_p; /* last item in the list */
+ ListItem_t *Curr_p; /* the "current" item in the list */
+ ListMemAllocFunction_t MemAllocFunc_p; /* pointer to
+ allocator function */
+ ListMemFreeFunction_t MemFreeFunc_p; /* pointer to the
+ memory freeing function */
+ bool ClientHandleStyle; /* True if General Map style
+ is applied */
+ void *ClientHandle_p; /* Store the client handle pointer if
+ callbacks is of ClientHandle style */
+};
+
+/**
+ * This function creates an empty list.
+ *
+ * @param [in] MemAlloc_p Pointer to an allocation function that complies to
+ * the following interface: void* Allocator(size_t Size);
+ * @param [in] MemFree_p Pointer to a de-allocation function that complies to
+ * the following interface: void Free(void* Mem_p);
+ *
+ * @return List_p Pointer to the list, null if unable to create list.
+ *
+ */
+List_t *Util_EListCreate(const ListMemAllocFunction_t MemAlloc_p,
+ const ListMemFreeFunction_t MemFree_p);
+/**
+ * This function creates an empty list with a client handle as input parameter.
+ * This client handle will be an input parameter in all callbacks to the client
+ * functions. For memory allocation and de-allocation is xmalloc and xfree are
+ * automatically selected.
+ *
+ * @param [in] ClientHandle_p Pointer to a client handle used in client callbacks
+ *
+ * @return List_p Pointer to the list, null if unable to create list.
+ *
+ */
+List_t *Util_EListCreateClientHandleStyle(const void *const ClientHandle_p);
+
+/**
+ * This function makes sure that the list pointer is not NULL. If it is, the
+ * function immediately returns LIST_STATUS_INVALID_LIST. Then the function
+ * returns the status of the list pointed to by List_p. The list status
+ * returned is a bit map. The returned value has to be bitwise ANDed with the
+ * status codes listed above in Return Values. See also Util_ListHead(),
+ * Util_ListTail(), Util_ListIsEmpty() and Util_ListOffList().
+ *
+ * @param [in] List_p Pointer to the list whose status will be obtained.
+ *
+ * @retval LIST_STATUS_LIST_EMPTY
+ * @retval LIST_STATUS_NOTHING_TO_REPORT
+ * @retval LIST_STATUS_PTR_OFF_LIST
+ * @retval LIST_STATUS_PTR_TO_TAIL
+ * @retval LIST_STATUS_PTR_TO_HEAD
+ * @retval LIST_STATUS_INVALID_LIST
+ *
+ */
+
+ListStatus_t Util_ListStatus(const List_t *const List_p);
+
+
+/**
+ * This function returns the number of elements in the list pointed to by
+ * List_p.
+ *
+ * @param [in] List_p Pointer to the list whose length will be
+ * obtained.
+ * @param [out] ListLength_p Number of elements in the list.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_INVALID_PARAM
+ *
+ */
+
+ListResult_t Util_ListLength(const List_t *const List_p,
+ uint16_t *const ListLength_p);
+
+
+/**
+ * This function makes sure that the list pointer is not NULL. If it is, the
+ * function immediately returns LIST_STATUS_INVALID_LIST. Then the function
+ * checks whether the list's current pointer for the list pointed to by List_p
+ * points to the tail of the list. If so the function returns
+ * LIST_STATUS_PTR_TO_TAIL, otherwise the function returns
+ * LIST_STATUS_NOTHING_TO_REPORT. See also Util_ListStatus(), Util_ListHead(),
+ * Util_ListIsEmpty() and Util_ListOffList().
+ *
+ * @param [in] List_p Pointer to the list whose current pointer will be
+ * checked against the list's tail.
+ *
+ * @retval LIST_STATUS_NOTHING_TO_REPORT
+ * @retval LIST_STATUS_PTR_TO_TAIL
+ * @retval LIST_STATUS_INVALID_LIST
+ *
+ */
+
+ListStatus_t Util_ListTail(const List_t *const List_p);
+
+
+/**
+ * This function makes sure that the list pointer is not NULL. If it is, the
+ * function immediately returns LIST_STATUS_INVALID_LIST. Then the function
+ * checks whether the list's current pointer for the list pointed to by List_p
+ * is pointing to an element inside the list. If so the function returns
+ * LIST_STATUS_NOTHING_TO_REPORT, otherwise the function returns
+ * LIST_STATUS_PTR_OFF_LIST. See also Util_ListStatus(), Util_ListTail(),
+ * Util_ListHead() and Util_ListIsEmpty().
+ *
+ * @param [in] List_p Pointer to the list whose current pointer is checked for
+ * validity. An invalid pointer is not pointing to an
+ * element inside the list.
+ *
+ * @retval LIST_STATUS_NOTHING_TO_REPORT
+ * @retval LIST_STATUS_PTR_OFF_LIST
+ * @retval LIST_STATUS_INVALID_LIST
+ *
+ */
+
+ListStatus_t Util_ListOffList(const List_t *const List_p);
+
+
+/**
+ * This function makes sure that the list pointer is not NULL. If it is, the
+ * function immediately returns LIST_STATUS_INVALID_LIST. Then the function
+ * checks whether the list's current pointer for the list pointed to by List_p
+ * points to the head of the list. If so the function returns
+ * LIST_STATUS_PTR_TO_HEAD, otherwise the function returns
+ * LIST_STATUS_NOTHING_TO_REPORT. See also Util_ListStatus(), Util_ListTail(),
+ * Util_ListIsEmpty() and Util_ListOffList().
+ *
+ * @param [in] List_p Pointer to the list whose current pointer will be
+ * checked against the list's head.
+ *
+ * @retval LIST_STATUS_NOTHING_TO_REPORT
+ * @retval LIST_STATUS_PTR_TO_HEAD
+ * @retval LIST_STATUS_INVALID_LIST
+ *
+ */
+ListStatus_t Util_ListHead(const List_t *const List_p);
+
+
+/**
+ * This function makes sure that the list pointer is not NULL. If it is, the
+ * function immediately returns LIST_STATUS_INVALID_LIST. Then the function
+ * checks whether the list pointed to by List_p is empty (i.e. created but no
+ * element in the list). If so the function returns LIST_STATUS_LIST_EMPTY,
+ * otherwise the function returns LIST_STATUS_NOTHING_TO_REPORT. See also
+ * Util_ListStatus(), Util_ListTail(), Util_ListHead() and Util_ListOffList().
+ *
+ * @param [in] List_p Pointer to the list to be verified for emptiness.
+ *
+ * @retval LIST_STATUS_NOTHING_TO_REPORT
+ * @retval LIST_STATUS_LIST_EMPTY
+ * @retval LIST_STATUS_INVALID_LIST
+ *
+ */
+ListStatus_t Util_ListIsEmpty(const List_t *const List_p);
+
+
+/**
+ * This function inserts the element pointed to by ElemContent_p before the
+ * element pointed to by the list's current pointer. When the function returns,
+ * the list's current pointer points to the newly added element.
+ *
+ * A key may be used to mark elements in the list. The list can then be
+ * searched using Util_ListMatchingKey() or Util_EListMatchingKey().
+ *
+ * In Util_ListInsertBefore(), the client provided key must be a NULL
+ * terminated string while in Util_EListInsertBefore(), the client provided key
+ * may be of any type.
+ *
+ * Notice that Util_ListInsertBefore() is provided for backward compatibility
+ * reason only. Use of Util_EListInsertBefore() is recommended in new
+ * implementations.
+ *
+ * See also Util_EListInsertAfter(), Util_ListInsertFirst(),
+ * Util_ListInsertLast(), Util_List_Remove(), Util_ListKeyedRemove() and
+ * Util_ListDelete().
+ *
+ * @param [in, out] List_p Pointer to the list in which the element will be
+ * inserted.
+ * @param [in] Key_p Pointer to a client's key. Key_p may be NULL.
+ * @param [in] ElemContent_p Pointer to the element to be inserted in the
+ * list.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_COULD_NOT_ALLOC_MEM
+ *
+ */
+
+ListResult_t Util_EListInsertBefore(List_t *const List_p,
+ const void *const Key_p,
+ void *const ElemContent_p);
+
+
+/**
+ * This function Util_ListInsertFirst() inserts the element pointed to by
+ * ElemContent_p at the head of the list. The
+ * list's current pointer remains unchanged.
+ *
+ * A key may be used to mark elements in the list. The list can then be
+ * searched using Util_ListMatchingKey() or Util_EListMatchingKey().
+ *
+ * See also Util_ListInsertAfter(), Util_EListInsertAfter(),
+ * Util_ListInsertLast(), Util_List_Remove(),
+ * Util_ListKeyedRemove() and Util_ListDelete().
+ *
+ * @param [in, out] List_p Pointer to the list in which the element will be
+ * inserted.
+ * @param [in] Key_p Pointer to a client's key. Key_p may be NULL.
+ * @param [in] ElemContent_p Pointer to the element to be inserted in the
+ * list.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_COULD_NOT_ALLOC_MEM
+ *
+ */
+ListResult_t Util_ListInsertFirst(List_t *const List_p, const void *const Key_p,
+ void *const ElemContent_p);
+
+
+/**
+ * This function inserts the element pointed to by ElemContent_p after the
+ * element pointed to by the list's current pointer. When the function returns,
+ * the list's current pointer points to the newly added element.
+ *
+ * A key may be used to mark elements in the list. The list can then be
+ * searched using Util_ListMatchingKey() or Util_EListMatchingKey().
+ *
+ * In Util_ListInsertAfter(), the client provided key must be a NULL terminated
+ * string while in Util_EListInsertAfter(), the client provided key may be of
+ * any type.
+ *
+ * Notice that Util_ListInsertAfter() is provided for backward compatibility
+ * reason only. Use of Util_EListInsertAfter() is recommended in new
+ * implementations.
+ *
+ * See also Util_EListInsertBefore(), Util_ListInsertFirst(),
+ * Util_ListInsertLast(), Util_List_Remove(), Util_ListKeyedRemove() and
+ * Util_ListDelete().
+ *
+ * @param [in, out] List_p Pointer to the list in which the element will be
+ * inserted.
+ * @param [in] Key_p Pointer to a client's key. Key_p must point to a
+ * NULL terminated string. Key_p may be NULL.
+ * @param [in] ElemContent_p Pointer to the element to be inserted in the
+ * list.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_COULD_NOT_ALLOC_MEM
+ *
+ */
+
+ListResult_t Util_EListInsertAfter(List_t *const List_p,
+ const void *const Key_p,
+ void *const ElemContent_p);
+
+
+/**
+ * This function Util_ListInsertLast()
+ * inserts the element pointed to by ElemContent_p at the tail of the list. The
+ * list's current pointer remains unchanged.
+ *
+ * A key may be used to mark elements in the list. The list can then be
+ * searched using Util_ListMatchingKey() or Util_EListMatchingKey().
+ *
+ * See also Util_ListInsertAfter(), Util_EListInsertAfter(),
+ * Util_ListInsertFirst(), Util_List_Remove(),
+ * Util_ListKeyedRemove() and Util_ListDelete().
+ *
+ * @param [in, out] List_p Pointer to the list in which the element will be
+ * inserted.
+ * @param [in] Key_p Pointer to a client's key. Key_p may be NULL.
+ * @param [in] ElemContent_p Pointer to the element to be inserted in the
+ * list.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_COULD_NOT_ALLOC_MEM
+ *
+ */
+ListResult_t Util_ListInsertLast(List_t *const List_p, const void *const Key_p,
+ void *const ElemContent_p);
+
+
+/**
+ * This function scans the list pointed to by List_p starting from the list's
+ * current pointer. Once the tail of the list has been searched, if an element
+ * has still not been found, the search resumes from the head of the list. The
+ * first element whose key matches the key pointed to by Key_p is removed.
+ *
+ * If a match is found, the list's current pointer will point to the element
+ * after the one removed. If the element removed is the tail of the list, the
+ * list's current pointer will point to the tail. When the last element is
+ * removed, the current pointer is set to NULL. If no match is found, the list
+ * is left unchanged.
+ *
+ * If the matching function is NULL, Util_ListKeyedRemove() will perform an
+ * integer comparison. Otherwise, the client provided routine will be used to
+ * compare keys.
+ *
+ * See also Util_EListInsertAfter(),
+ * Util_EListInsertBefore (), Util_ListInsertFirst(), Util_ListInsertLast(),
+ * Util_List_Remove() and Util_ListDelete().
+ *
+ * @param [in, out] List_p Pointer to the list to be searched and from
+ * which the found element will be removed
+ * @param [in] Key_p Pointer to the key that identifies the
+ * element to be removed.
+ * @param [in] KeyMatchingFunc_p Client function that knows how to compare
+ * keys of the client specific key data type.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_PARAM
+ * @retval LIST_ERROR_NO_MATCH_FOUND
+ *
+ */
+
+ListResult_t Util_ListKeyedRemove(List_t *const List_p,
+ const void *const Key_p,
+ const ListKeyMatchingFunction_t KeyMatchingFunc_p);
+
+/**
+ * This function scans the list pointed to by List_p starting from the list's
+ * current pointer. Once the tail of the list has been searched, if a matching
+ * element has still not been found, the search resumes from the head of the
+ * list.
+ *
+ * The first element whose key matches the key pointed to by Key_p is returned.
+ * Notice that if more than one element in the list match the specified key,
+ * only the first one (from and including the element at the current pointer)
+ * is returned. If more matching elements are desired, the client must
+ * increment the current pointer (using Util_ListNext() or Util_ListIsNext())
+ * and call the matching function again (Util_EListMatchingKey() or
+ * Util_ListMatchingKey).
+ *
+ * If no element in the list matches or if invalid parameters are specified,
+ * the function returns NULL.
+ *
+ * Note that for Util_ListMatchingKey, the key matching function is a string
+ * comparison and is case sensitive. The string matching only matches the
+ * characters in Key_p (e.g. key_p = "Blue" will match "BlueSky" and "Blue
+ * Color" but not "blueSky" or "Blu").
+ *
+ * In Util_EListMatchingKey, KeyMatchingFunc_p is a client specific comparison
+ * function. If NULL is specified, an integer comparison (i.e. the element
+ * pointed to by Key_p is assumed to be a signed integer) will be performed by
+ * default. If KeyMatchingFunc_p is not NULL, the client specific comparison
+ * function will be used to match the Key_p.
+ *
+ * @param [in, out] List_p Pointer to the list to be searched.
+ * @param [in] Key_p Pointer to a client's key. In Util_ListMatchingKey(),
+ * Key_p must point to a NULL terminated string. In
+ * Util_EListMatchingKey(), Key_p points to a key for which
+ * the type is not known to the list library.
+ * @param [in] KeyMatchingFunc_p The client's function to be used to compare keys
+ *
+ * @return void* Address of the element whose key has matched Key_p. NULL if no
+ * match has been found or if the list is invalid. The current pointer
+ * into the list points to the element returned or is not changed if
+ * the function returns NULL.
+ *
+ */
+
+void *Util_EListMatchingKey(List_t *const List_p, const void *const Key_p,
+ const ListKeyMatchingFunction_t KeyMatchingFunc_p);
+
+/**
+ * This function is similar to Util_EListMatchingKey except that the the comparison
+ * function follows the General Map ClientHandle style with client handle as a
+ * parameter in the callback.
+ * @param [in, out] List_p Pointer to the list to be searched.
+ * @param [in] Key_p Pointer to a client's key. In Util_ListMatchingKey(),
+ * Key_p must point to a NULL terminated string. In
+ * Util_EListMatchingKey(), Key_p points to a key for which
+ * the type is not known to the list library.
+ * @param [in] KeyMatchingFunc The client's function to be used to compare keys with
+ * general map ClientHandle style.
+ *
+ * @return void* Address of the element whose key has matched Key_p. NULL if no
+ * match has been found or if the list is invalid. The current pointer
+ * into the list points to the element returned or is not changed if
+ * the function returns NULL.
+ *
+ */
+void *Util_EListMatchingKeyClientHandleStyle(List_t *const List_p,
+ const void *const Key_p,
+ const ListKeyMatchingFunctionClientHandleStyle_t KeyMatchingFunc);
+
+/**
+ * This function scans the list pointed to by List_p starting from the list's
+ * current pointer. Once the tail of the list has been searched, if an element
+ * has still not been found, the search resumes from the head of the list. The
+ * position in the list of the first element whose key matches the key pointed
+ * to by Key_p is returned. The position is counted from the head to the tail
+ * starting at position 1 for the head.
+ *
+ * If a match is found, the list's current pointer will point to the matched
+ * element. If no match is found, the list is left unchanged.
+ *
+ * If the matching function is NULL, Util_ListKeyedIndex() will perform an
+ * integer comparison. Otherwise, the client provided routine will be used to
+ * compare keys.
+ *
+ * See also Util_ListCurrIndex().
+ *
+ * @param [in, out] List_p Pointer to the list to be searched and from
+ * which the index to the matched element will be
+ * returned.
+ * @param [in] Key_p Pointer to the key that identifies the
+ * element for which the index will be returned.
+ * @param [in] KeyMatchingFunc_p Client function that knows how to compare
+ * keys of the client specific key data type.
+ *
+ * @return int Position of the element found in the list or -1 if the element
+ * could not be found (because the specified key is not found or
+ * input parameters are invalid).
+ */
+
+int Util_ListKeyedIndex(List_t *const List_p, const void *const Key_p,
+ const ListKeyMatchingFunction_t KeyMatchingFunc_p);
+
+
+/**
+ * This function returns the index of the list's current element or -1 if the
+ * current element is not valid. The index of the element at the head of the
+ * list is 1.
+ *
+ * See also Util_ListKeyedIndex().
+ *
+ * @param [in] List_p Pointer to the list from which the index to the current
+ * element will be returned.
+ *
+ * @return int Position of the element pointed to by the list's current pointer
+ * or -1 if the list's current pointer is NULL or
+ * input parameters are invalid).
+ */
+int Util_ListCurrIndex(const List_t *const List_p);
+
+
+/**
+ * This function relinks the elements from index First to Last inclusively
+ * after the element at position "To". After the function has executed
+ * successfully, the element at index First will appear directly after the
+ * element at index To. "To" may not be between First and Last but may be
+ * smaller than First or larger than Last. After successful completion, the
+ * list's current pointer is reset (see Util_ListResetCurr()).
+ *
+ * @param [in, out] List_p Pointer to the list in which a range of elements will be
+ * moved.
+ * @param [in] First The position of the first element to be relinked.
+ * @param [in] Last The position of the last element to be relinked.
+ * First and Last Indices defines the range of elements to move.
+ * The range includes First and Last elements. Last must be
+ * greater or equal to First. Notice that these are not
+ * const because the function uses these variables
+ * internally and changes their values. This is done to
+ * avoid defining extra local variables and initialising
+ * them with input parameters.
+ * @param [in] To The index of the element in the list AFTER which the
+ * range of elements from First to Last will be linked.
+ * Notice that this is not a const because the function uses
+ * this variable internally and changes its value. This is
+ * done to avoid defining an extra local variable and
+ * initialising it with the input parameter.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_PARAM
+ *
+ */
+
+ListResult_t Util_ListMoveSubrange(List_t *const List_p, uint16_t First,
+ uint16_t Last, uint16_t To);
+
+/**
+ * This function removes the elements from index First to index Last
+ * inclusively from FromList_p and links them to the tail of the list pointed
+ * to by ToList_p.
+ *
+ * The list current pointer is reset in both FromList_p and ToList_p.
+ *
+ * @param [in, out] List_p Pointer to the list from which a range of elements
+ * will be removed.
+ * @param [in] First The position of the first element to be relinked.
+ * @param [in] Last The position of the last element to be relinked.
+ * First and Last Indices defines the range of elements to move.
+ * The range includes First and Last elements. Last must be
+ * greater or equal to First. Notice that these are not
+ * const because the function uses these variables
+ * internally and changes their values. This is done to
+ * avoid defining extra local variables and initialising
+ * them with input parameters.
+ * @param [in, out] ToList_p The list where the range of elements from List_p will
+ * be linked.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_PARAM
+ *
+ */
+
+ListResult_t Util_ListGetSubrange(List_t *const FromList_p, uint16_t First,
+ uint16_t Last, List_t *const ToList_p);
+
+/**
+ * This function sets the list's current pointer to NULL.
+ *
+ * It is typically used to prepare the list before an iteration through the
+ * list using Util_ListIsNext() or Util_ListIsPrev(). Util_ListIsNext() is
+ * used to start iterating from the head and Util_ListIsPrev() is used to start
+ * iterating from the tail.
+ *
+ * @param [in, out] List_p Pointer to the list whose current element pointer will
+ * be reset.
+ *
+ * @return TRUE if the list's current pointer can be reset.
+ * Otherwise, it returns FALSE (i.e. if the list is empty)
+ */
+
+bool Util_ListResetCurr(List_t *const List_p);
+
+
+/**
+ * This function moves the list's current pointer to the tail of the list. It
+ * returns the pointer to the element at the tail of the list or NULL if the
+ * list is empty.
+ *
+ * See also Util_ListNext(), Util_ListPrev(), Util_ListGotoHead(),
+ * Util_ListGotoIth() and Util_ListCurr().
+ *
+ * @param [in, out] List_p Pointer to the list whose current pointer will be moved.
+ *
+ * @return void* Address of the tail element. NULL if list empty.
+ */
+void *Util_ListGotoTail(List_t *const List_p);
+
+/**
+ * This function moves the list's current pointer to the head of the list. It
+ * returns the pointer to the element at the head of the list or NULL if the
+ * list is empty.
+ *
+ * See also Util_ListNext(), Util_ListPrev(), Util_ListGotoTail(),
+ * Util_ListGotoIth() and Util_ListCurr().
+ *
+ * @param [in, out] List_p Pointer to the list whose current pointer will be moved.
+ *
+ * @return void* Address of the head element. NULL if list empty.
+ */
+
+void *Util_ListGotoHead(List_t *const List_p);
+
+
+/**
+ * This function moves the list's current pointer to the i:th element of the
+ * list. The head of the list is element 1, the next one is element 2 and so
+ * on. It returns the pointer to the element or NULL if the list does not
+ * contain at least i element(s).
+ *
+ * See also Util_ListNext(), Util_ListPrev(), Util_ListGotoHead(),
+ * Util_ListGotoTail() and Util_ListCurr().
+ *
+ * @param [in, out] List_p Pointer to the list whose current pointer will be moved.
+ * @param [in] i The element rank in the list. The head of the list is
+ * element 1, the next one is element 2 and so on.
+ *
+ * @return void* Address of the current element. NULL if list empty
+ * or not long enough.
+ */
+
+void *Util_ListGotoIth(List_t *const List_p, uint16_t i);
+
+/**
+ * This function returns the pointer to the element pointed to by the list's
+ * current pointer or NULL if the current pointer points outside the list.
+ *
+ * See also Util_ListNext(), Util_ListPrev(), Util_ListGotoHead(),
+ * Util_ListGotoTail() and Util_ListGotoIth().
+ *
+ * @param [in] List_p Pointer to the list whose element pointed to by the
+ * list's current pointer will be returned
+ *
+ * @return void* The address of the contents of the current element, null
+ * if there is no current element.
+ */
+void *Util_ListCurr(const List_t *const List_p);
+
+
+/**
+ * This function advances the list's current pointer by one element towards the
+ * tail of the list. It returns the pointer to the element or NULL if the
+ * current pointer pointed to the tail of the list prior to the call.
+ *
+ * If the current pointer is NULL prior to the call and the list is not empty,
+ * the current pointer will point to the head of the list.
+ *
+ * See also Util_ListPrev(), Util_ListGotoHead(), Util_ListGotoTail(),
+ * Util_ListGotoIth(), Util_ListCurr() and Util_ListIsNext().
+ *
+ * @param [in, out] List_p Pointer to the list whose current pointer will be moved.
+ *
+ * @return void* The address of the contents of the next element, NULL
+ * if there is no next element or list is empty.
+ */
+void *Util_ListNext(List_t *const List_p);
+
+
+/**
+ * This function advances the list's current pointer by one element towards the
+ * tail of the list.
+ *
+ * If the current pointer is NULL prior to the call and the list is not empty,
+ * the current pointer will point to the head of the list.
+ *
+ * The function returns TRUE if the current pointer has been stepped, otherwise
+ * it returns FALSE.
+ *
+ * See also Util_ListResetCurr(), Util_ListIsPrev() and Util_ListNext().
+ *
+ * @param [in, out] List_p Pointer to the list whose current pointer will be moved.
+ *
+ * @return TRUE if the current list pointer was not already at the tail before
+ * call. Otherwise, it returns FALSE (e.g. if the list is empty)
+ *
+ */
+bool Util_ListIsNext(List_t *const List_p);
+
+
+/**
+ * This function moves the list's current pointer by one element towards the
+ * head of the list. It returns the pointer to the element or NULL if the
+ * current pointer pointed to the head of the list prior to the call.
+ *
+ * If the current pointer is NULL prior to the call and the list is not empty,
+ * the current pointer will point to the tail of the list.
+ *
+ * See also Util_ListNext(), Util_ListGotoHead(), Util_ListGotoTail(),
+ * Util_ListGotoIth(), Util_ListCurr() and Util_ListIsPrev().
+ *
+ * @param [in, out] List_p Pointer to the list whose current pointer will be moved.
+ *
+ * @return void* The address of the contents of the previous element, NULL
+ * if there is no prev element or list is empty.
+ *
+ */
+void *Util_ListPrev(List_t *const List_p);
+
+
+
+/**
+ * This function advances the list's current pointer by one element towards the
+ * head of the list.
+ *
+ * If the current pointer is NULL prior to the call and the list is not empty,
+ * the current pointer will point to the tail of the list.
+ *
+ * The function returns TRUE if the current pointer has been stepped, otherwise
+ * it returns FALSE.
+ *
+ * See also Util_ListResetCurr(), Util_ListIsNext() and Util_ListPrev().
+ *
+ * @param [in, out] List_p Pointer to the list whose current pointer will be moved.
+ *
+ * @return TRUE if the current pointer has been stepped, otherwise
+ * it returns FALSE.
+ */
+
+bool Util_ListIsPrev(List_t *const List_p);
+
+
+/**
+ * This function removes the element pointed to by the list's current pointer
+ * from the list. After the function has completed, the list's current pointer
+ * will point to the next element or the previous element if the list's tail is
+ * removed. The current pointer will be NULL after the last element in the list
+ * has been removed.
+ *
+ * See also Util_ListDelete(), Util_ListKeyedRemove(),
+ * Util_ListInsertAfter(),
+ * Util_EListInsertAfter, Util_ListInsertFirst(),
+ * Util_ListInsertLast(), Util_EListInsertBefore() and
+ * Util_ListInsertBefore().
+ *
+ * @param [in, out] List_p Pointer to the list from which the element pointed to by
+ * the list's current pointer will be removed.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_CURRENT_PTR_OFF_LIST
+ *
+ */
+
+ListResult_t Util_ListRemove(List_t *const List_p);
+
+
+/**
+ * This function deletes the element pointed to by the list's current pointer
+ * from the list. If DelFunc is not NULL, the client's delete function will
+ * be called prior to removing the current element from the list. If DelFunc
+ * is NULL, the element is not freed.
+ *
+ * See also Util_ListRemove(), Util_ListInsertAfter(), Util_EListInsertBefore()
+ * and Util_ListInsertBefore().
+ *
+ * @param [in, out] List_p Pointer to the list whose status will be obtained.
+ * @param [in] DelFunc Function provided by client that knows how to
+ * deallocate the resources associated with the element
+ * to be deleted. NULL indicates that the client does not
+ * require the element's resources to be deallocated
+ * within the Util_ListDelete() function.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_CURRENT_PTR_OFF_LIST
+ *
+ */
+
+ListResult_t Util_ListDelete(List_t *const List_p,
+ const ListDeleteFunction_t DelFunc);
+/**
+ * This function deletes the element pointed to by the list's current pointer
+ * from the list. If DelFunc_p is not NULL, the client's delete function will
+ * be called prior to removing the current element from the list. If DelFunc
+ * is NULL, the element is not freed.
+ *
+ * See also Util_ListRemove(), Util_ListInsertAfter(), Util_EListInsertBefore()
+ * and Util_ListInsertBefore().
+ *
+ * @param [in, out] List_p Pointer to the list whose status will be obtained.
+ * @param [in] DelFunc Function provided by client that knows how to
+ * deallocate the resources associated with the element
+ * to be deleted. NULL indicates that the client does not
+ * require the element's resources to be deallocated
+ * within the Util_ListDelete() function. The DelFunc should
+ * be of type ListDeleteFunctionGeneralMap_t (see t_list.h) and
+ * is slightly different from the one used in Util_ListDelete.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_CURRENT_PTR_OFF_LIST
+ *
+ */
+
+ListResult_t Util_ListDeleteGeneralMap(List_t *const List_p,
+ const ListDeleteFunctionGeneralMap_t DelFunc);
+
+/**
+ * This function deletes the element pointed to by the list's current pointer
+ * from the list. If DelFunc is not NULL, the client's delete function will
+ * be called prior to removing the current element from the list. If DelFunc
+ * is NULL, the element is not freed. This function is slightly
+ * different from above
+ * Util_ListDeleteGeneralMap. Support for Client Handle is added in the
+ * callback function.
+ *
+ * See also Util_ListRemove(), Util_ListInsertAfter(), Util_EListInsertBefore()
+ * and Util_ListInsertBefore().
+ *
+ * @param [in, out] List_p Pointer to the list whose status will be obtained.
+ * @param [in] DelFunc Function provided by client that knows how to
+ * deallocate the resources associated with the element
+ * to be deleted. NULL indicates that the client does not
+ * require the element's resources to be deallocated
+ * within the Util_ListDelete() function. The DelFunc should
+ * be of type ListDeleteFunctionGeneralMapClientHandleStyle_t
+ * (see t_list.h) and is slightly different from the one
+ * used in Util_ListDeleteGeneralMap. This function type
+ * include support for client handles in user callbacks.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ * @retval LIST_ERROR_CURRENT_PTR_OFF_LIST
+ *
+ */
+
+ListResult_t Util_ListDeleteGeneralMapClientHandleStyle(List_t *const List_p,
+ const ListDeleteFunctionGeneralMapClientHandleStyle_t DelFunc);
+
+/**
+ * This function removes and deletes all the elements in the list pointed to by
+ * List_pp. If the client specified a delete function (i.e. DelFunc is not
+ * NULL), it is called for each element in the list. If DelFunc_p is set to
+ * NULL, the list is destroyed but the elements are not freed.
+ *
+ * The pointer to the list is set to NULL upon return.
+ *
+ * See also Util_ListCreate(), Util_EListCreate().
+ *
+ * @param [in, out] List_pp Pointer to the list pointer to be destroyed.
+ * @param [in] DelFunc Function provided by client that knows how a
+ * client's element can be destroyed. NULL indicates that
+ * the elements in the list don't need to be freed while
+ * destroying the list.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ *
+ */
+
+ListResult_t Util_ListDestroy(List_t **List_pp,
+ const ListDeleteFunction_t DelFunc);
+
+/**
+ * This function removes and deletes all the elements in the list pointed to by
+ * List_pp. If the client specified a delete function (i.e. DelFunc is not
+ * NULL), it is called for each element in the list. If DelFunc_p is set to
+ * NULL, the list is destroyed but the elements are not freed.
+ *
+ * The pointer to the list is set to NULL upon return.
+ *
+ * See also Util_ListCreate(), Util_EListCreate().
+ *
+ * @param [in, out] List_pp Pointer to the list pointer to be destroyed.
+ * @param [in] DelFunc Function provided by client that knows how a
+ * client's element can be destroyed. NULL indicates that
+ * the elements in the list don't need to be freed while
+ * destroying the list. The DelFunc should
+ * be of type ListDeleteFunctionGeneralMap_t (see t_list.h) and
+ * is slightly different from the one used in Util_ListDestroy.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ *
+ */
+
+ListResult_t Util_ListDestroyGeneralMap(List_t **List_pp,
+ const ListDeleteFunctionGeneralMap_t DelFunc);
+
+/**
+ * This function removes and deletes all the elements in the list pointed to by
+ * List_pp. If the client specified a delete function (i.e. DelFunc is not
+ * NULL), it is called for each element in the list. If DelFunc_p is set to
+ * NULL, the list is destroyed but the elements are not freed. This function is
+ * slightly different from above
+ * Util_ListDestroyGeneralMap. Support for Client Handle is added in the
+ * callback function.
+ *
+ * The pointer to the list is set to NULL upon return.
+ *
+ * See also Util_ListCreate(), Util_EListCreate().
+ *
+ * @param [in, out] List_pp Pointer to the list pointer to be destroyed.
+ * @param [in] DelFunc Function provided by client that knows how a
+ * client's element can be destroyed. NULL indicates that
+ * the elements in the list don't need to be freed while
+ * destroying the list. The DelFunc should
+ * be of type ListDeleteFunctionGeneralMapClientHandleStyle_t
+ * (see t_list.h) and is slightly different from the one
+ * used in Util_ListDestroyGeneralMap. This function type
+ * include support for client handles in user callbacks.
+ *
+ * @retval LIST_SUCCESS
+ * @retval LIST_ERROR_INVALID_LIST
+ *
+ */
+ListResult_t Util_ListDestroyGeneralMapClientHandleStyle(List_t **List_pp,
+ const ListDeleteFunctionGeneralMapClientHandleStyle_t DelFunc);
+
+/**
+ * This function prints the information about the list. While printing
+ * information about the list, the list is scanned. If debug information about
+ * the element content is desired, the client must specify the debug routine,
+ * DbgFunc_p, that knows how to print this information. DbgFunc_p equal to NULL
+ * indicates that no debug information about the element's contents is desired.
+ *
+ *
+ * It is ONLY meant to be used during development and integration. It should be
+ * configured out of the library before the release. This can be done by
+ * defining REMOVE_UF_LISTPRINTDEBUG in the product's product.defines file.
+ *
+ * @param [in, out] List_p Pointer to the list whose debug information will be
+ * printed.
+ * @param [in] DbgFunc Client's function that is called to
+ * print debug information about the content of the
+ * elements in the list. DbgFunc_p can be NULL.
+ *
+ */
+
+void Util_ListPrintDebug(List_t *const List_p,
+ const ListDebugFunction_t DbgFunc);
+
+/**
+ * This function prints the information about the list. While printing
+ * information about the list, the list is scanned. If debug information about
+ * the element content is desired, the client must specify the debug routine,
+ * DbgFunc_p, that knows how to print this information. DbgFunc_p equal to NULL
+ * indicates that no debug information about the element's contents is desired.
+ *
+ * This function has been added to conform with the function type used in
+ * General Map for Util_Map_CallForEach.
+ *
+ * It is ONLY meant to be used during development and integration. It should be
+ * configured out of the library before the release. This can be done by
+ * defining REMOVE_UF_LISTPRINTDEBUGGENERALMAP in the
+ * product's product.defines file.
+ *
+ * @param [in, out] List_p Pointer to the list whose debug information will be
+ * printed.
+ * @param [in] DbgFunc Function of type ListDebugFunctionGeneralMap_t
+ * that agrees with the style used in general Map.
+ *
+ */
+
+void Util_ListPrintDebugGeneralMap(List_t *const List_p,
+ const ListDebugFunctionGeneralMap_t DbgFunc);
+
+/*************************************************************************
+ * Macros
+ **************************************************************************/
+
+/**
+ * LIST_APPEND(Element_p, Key_p, List_p) is used to insert an element at the
+ * tail of a doubly linked list.
+ * Example:
+ *
+ * List* MyList_p = NULL;
+ * ClientElementType_t* MyElement_p;
+ * ....
+ * MyElement_p = HEAP_ALLOC(ClientElementType_t);
+ * ....
+ * LIST_APPEND(MyElement_p, NULL, MyList_p)
+ *
+ *
+ * @param [in] Element_p Pointer to the client's element to be inserted in the list
+ * @param [in] Key_p Pointer the the element's key. Key_p can be NULL.
+ * @param [in] List_p Pointer to the doubly linked list. If List_p points to NULL,
+ * then the macro will create the list.
+ *
+ */
+
+#define LIST_APPEND(Element_p, Key_p, List_p) \
+ { \
+ if ((List_p) == NULL) \
+ (List_p) = Util_EListCreate(xmalloc, xfree); \
+ Util_ListGotoTail(List_p); \
+ Util_ListInsertAfter((List_p), (Key_p), (Element_p)); \
+ }
+
+/**
+ * LIST_FOR_EACH_ELEMENT_IN_LIST(ElementDataType_t, Element_p, List_p)
+ * iterates through all elements in the list from head to tail.
+ * Example:
+ * Given that the list MyList_p has been created and several elements added to
+ * it, the client could iterate through the list from head to tail using the
+ * following simple construct.
+ *
+ * LIST_FOR_EACH_ELEMENT_IN_LIST(ElementType_t, ThisElement_p, MyList_p)
+ * {
+ * // Here is the client code to manipulate
+ * each element (pointed to by ThisElement_p)
+ * }
+ *
+ * @param [in] ElementDataType_t The data type of the elements in the list pointed to by List_p)
+ * @param [in] Element_p Points to the element being iterated.
+ * @param [in] List_p Pointer to the doubly linked list to be iterated.
+ *
+ */
+
+#define LIST_FOR_EACH_ELEMENT_IN_LIST(ElementDataType_t, Element_p, List_p) \
+ { \
+ if (!(List_p)) \
+ ; \
+ else \
+ for ((List_p)->Curr_p = (List_p)->Head_p \
+ ; \
+ (List_p)->Curr_p && NULL != \
+ ((Element_p) = \
+ (ElementDataType_t *)(List_p)->\
+ Curr_p->Body_p) \
+ ; \
+ ((List_p)->Curr_p = (List_p)->Curr_p->Next_p)) \
+ ; \
+ }
+
+/**
+ *
+ * LIST_LENGTH(List_p) returns the number of elements in the list.
+ * Example:
+ * Given that the list MyList_p has been created and several elements added to
+ * it, the client could obtain the number of elements in the list using this
+ * macro.
+ *
+ * uint16_t ListLength;
+ * ....
+ *
+ * if (MyList_p)
+ * {
+ * ListLength = LIST_LENGTH(MyList_p);
+ * }
+ *
+ *
+ * @param [in] List_p A pointer to the doubly linked list whose length will be obtained.
+ * LIST_LENGTH must not be expanded with a pointer to NULL
+ *
+ */
+
+#define LIST_LENGTH(List_p) { (List_p)->NbrOfElements }
+
+
+
+#endif /* INCLUSION_GUARD_R_LIST_H */
diff --git a/host/xtest/adbg/src/r_list_genutil.c b/host/xtest/adbg/src/r_list_genutil.c
new file mode 100644
index 0000000..81e3e35
--- /dev/null
+++ b/host/xtest/adbg/src/r_list_genutil.c
@@ -0,0 +1,1675 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+**************************************************************************
+*
+* DESCRIPTION:
+*
+* Source file containing the functions for the manipulation of doubly
+* linked lists.
+* A linked list can be created/deleted, elements can be added/removed,
+* the list can be
+* traversed in both directions, the current list index can be moved in
+* different ways
+* (to head, to tail, to a specific index). The elements in a list can be
+* identified with a key (NULL terminated character string).
+* The key is specified by the client.
+* A function allows the client to look for the next (from head to tail)
+* element with a given key. Key usage is of course optional.
+* The library allocates memory only for the management of the list.
+* The client's data must be allocated by the client.
+* If so desired by the client, the client's data
+* can however be freed when the list is destroyed.
+*************************************************************************/
+
+/*************************************************************************
+* Includes
+*************************************************************************/
+
+#include "r_list.h"
+#include <stdlib.h>
+#include <string.h>
+
+#define C_(x)
+#define B_(x)
+#define PRE_CONDITION(a, b)
+#define IDENTIFIER_NOT_USED(x) { if (sizeof(&x)) {} }
+
+/*************************************************************************
+* Definition of external constants and variables
+*************************************************************************/
+
+/*************************************************************************
+* File scope types, constants and variables
+*************************************************************************/
+
+/*************************************************************************
+* Declaration of file local functions
+*************************************************************************/
+static bool ListIntComparisonFunc(const void *AnElementKey_p,
+ const void *KeyToMatch_p);
+
+static bool ListMoveForward(uint16_t NbrOfElement, ListItem_t **Element_pp);
+
+/*************************************************************************
+* Definition of functions
+*************************************************************************/
+
+/*************************************************************************
+ *
+ * Name: ListIntComparisonFunc
+ *
+ * Parameters: AnElementKey_p [In]
+ * A pointer to an element's key
+ * KeyToMatch_p [In]
+ * The pointer to the key to match
+ *
+ * Returns: true if the element's key is equal to the key to match
+ *
+ * Description: This function is used in conjunction to trying to find a key
+ * match in a linked list. The function is only used when the
+ * client of the list library does not provide a key matching
+ * function when calling Util_EListMatchingKey(), in which case,
+ * it is assumed that the key is a 32 bit unsigned integer.
+ *
+ **************************************************************************/
+bool ListIntComparisonFunc(const void *AnElementKey_p, const void *KeyToMatch_p)
+{
+ if (*((uint32_t *)(AnElementKey_p)) == *((uint32_t *)(KeyToMatch_p)))
+ return true;
+ else
+ return false;
+}
+
+/*************************************************************************
+ *
+ * Name: ListMoveForward
+ *
+ * Parameters: NbrOfElements [In]
+ * Nbr of elements the list should be traversed by
+ * Element_pp [In/Out]
+ * The pointer to the list element pointer from where
+ * the list will be traversed.
+ * On return, Element_pp will point to the element
+ * That is linked NbrOfElements after the starting element.
+ *
+ * Returns: true if the list could be traversed by NbrOfElements.
+ * false if the end of the list is reached before
+ * having traversed the list by NbrOfElements.
+ *
+ * Description: This function is used in conjunction with ListMoveSubrange().
+ *
+ **************************************************************************/
+static bool ListMoveForward(uint16_t NbrOfElements, ListItem_t **Element_pp)
+{
+ while (NbrOfElements != 0 && *Element_pp != NULL) {
+ *Element_pp = (*Element_pp)->Next_p;
+ NbrOfElements--;
+ }
+ if (*Element_pp == NULL)
+ return false;
+ else
+ return true;
+}
+
+
+/*************************************************************************
+ *
+ * Name: ListStrComparisonFunc
+ *
+ * Parameters: AnElementKey_p [In]
+ * A pointer to an element's key
+ * KeyToMatch_p [In]
+ * The pointer to the key to match
+ *
+ * Returns: true if the element's key is equal to the key to match
+ *
+ * Description: This function is used in conjunction to trying to find a key
+ * match in a linked list. The function is only used when the
+ * client of the list library use the obsolete
+ * Util_ListMatchingKey()
+ * function which always expects the key to be a NULL terminated
+ * string.
+ *
+ **************************************************************************/
+bool ListStrComparisonFunc(const void *AnElementKey_p, const void *KeyToMatch_p)
+{
+ if (strncmp(AnElementKey_p, KeyToMatch_p, strlen(KeyToMatch_p)) == 0)
+ return true;
+ else
+ return false;
+}
+
+/*
+ * NAME
+ * Util_EListCreate
+ */
+#ifndef REMOVE_UF_LISTCREATE
+List_t *Util_EListCreate(const ListMemAllocFunction_t MemAlloc_p,
+ const ListMemFreeFunction_t MemFree_p)
+{
+ List_t *List_p;
+ ListMemAllocFunction_t MyMemAlloc_p;
+ ListMemFreeFunction_t MyMemFree_p;
+
+ /* if no allocation function or no free function
+ specified, then use xmalloc and xfree */
+ if (MemAlloc_p && MemFree_p) {
+ MyMemAlloc_p = MemAlloc_p;
+ MyMemFree_p = MemFree_p;
+ } else {
+ MyMemAlloc_p = xmalloc;
+ MyMemFree_p = xfree;
+ }
+
+ List_p = (List_t *)MyMemAlloc_p(sizeof(List_t));
+ if (List_p != NULL) {
+ List_p->Head_p = NULL;
+ List_p->Tail_p = NULL;
+ List_p->Curr_p = NULL;
+ List_p->NbrOfElements = 0;
+ List_p->MemAllocFunc_p = MyMemAlloc_p;
+ List_p->MemFreeFunc_p = MyMemFree_p;
+ List_p->ClientHandleStyle = false;
+ List_p->ClientHandle_p = NULL;
+ }
+
+ C_(printf("\nUtil_EListCreate: List = 0x%x", (int)List_p);)
+
+ return List_p;
+}
+#endif /* REMOVE_UF_LISTCREATE */
+/*
+ * NAME
+ * Util_EListCreateClientHandleStyle
+ */
+#ifndef REMOVE_UF_LISTCREATECLIENTHANDLESTYLE
+List_t *Util_EListCreateClientHandleStyle(const void *const ClientHandle_p)
+{
+ List_t *List_p;
+
+ List_p = (List_t *)xmalloc(sizeof(List_t));
+ if (NULL != List_p) {
+ List_p->Head_p = NULL;
+ List_p->Tail_p = NULL;
+ List_p->Curr_p = NULL;
+ List_p->NbrOfElements = 0;
+ List_p->MemAllocFunc_p = xmalloc;
+ List_p->MemFreeFunc_p = xfree;
+ List_p->ClientHandleStyle = true;
+ List_p->ClientHandle_p = (void *)ClientHandle_p;
+ }
+
+ C_(printf("\nUtil_EListCreate: List = 0x%x", (int)List_p);)
+
+ return List_p;
+}
+#endif /* REMOVE_UF_LISTCREATECLIENTHANDLESTYLE */
+
+/*
+ * NAME
+ * Util_ListLength
+ *
+ */
+#ifndef REMOVE_UF_LISTLENGTH
+ListResult_t Util_ListLength(const List_t *const List_p,
+ uint16_t *const ListLength_p)
+{
+ PRE_CONDITION(List_p != NULL, return LIST_ERROR_INVALID_LIST);
+ PRE_CONDITION(ListLength_p != NULL, return LIST_ERROR_INVALID_PARAM);
+
+ *ListLength_p = List_p->NbrOfElements;
+ return LIST_SUCCESS;
+}
+
+#endif /* REMOVE_UF_LISTLENGTH */
+/*
+ * NAME
+ * Util_ListTail
+ *
+ *
+ */
+#ifndef REMOVE_UF_LISTTAIL
+ListStatus_t Util_ListTail(const List_t *const List_p)
+{
+ ListStatus_t Result;
+
+ PRE_CONDITION(List_p != NULL, return LIST_STATUS_INVALID_LIST);
+
+ Result = LIST_STATUS_NOTHING_TO_REPORT;
+
+ if (List_p->Curr_p != NULL) {
+ if (List_p->Curr_p->Next_p == NULL)
+ Result = LIST_STATUS_PTR_TO_TAIL;
+
+ }
+ C_(printf("\nUtil_ListHead: %d, List = 0x%x", Result, (int)List_p);)
+ return Result;
+}
+#endif /* REMOVE_UF_LISTTAIL */
+
+/*
+ * NAME
+ * Util_ListOffList
+ *
+ */
+#ifndef REMOVE_UF_LISTOFFLIST
+ListStatus_t Util_ListOffList(const List_t *const List_p)
+{
+ ListStatus_t Result;
+
+ PRE_CONDITION(List_p != NULL, return LIST_STATUS_INVALID_LIST);
+
+ if (List_p->Curr_p == NULL)
+ Result = LIST_STATUS_PTR_OFF_LIST;
+ else
+ Result = LIST_STATUS_NOTHING_TO_REPORT;
+
+ C_(printf("\nUtil_ListOffList: %d, List = 0x%x", Result, (int)List_p);)
+ return Result;
+}
+#endif /* REMOVE_UF_LISTOFFLIST */
+/*
+ * NAME
+ * Util_ListHead
+ *
+ *
+ */
+#ifndef REMOVE_UF_LISTHEAD
+ListStatus_t Util_ListHead(const List_t *const List_p)
+{
+ ListStatus_t Result;
+
+ PRE_CONDITION(List_p != NULL, return LIST_STATUS_INVALID_LIST);
+
+ Result = LIST_STATUS_NOTHING_TO_REPORT;
+
+ if (List_p->Curr_p != NULL) {
+ if (List_p->Curr_p->Prev_p == NULL)
+ Result = LIST_STATUS_PTR_TO_HEAD;
+
+ }
+ C_(printf("\nUtil_ListHead: %d, List = 0x%x", Result, (int)List_p);)
+ return Result;
+}
+#endif /* REMOVE_UF_UTIL_LISTHEAD */
+/*
+ * NAME
+ * Uilt_ListIsEmpty
+ *
+ */
+#ifndef REMOVE_UF_LISTISEMPTY
+ListStatus_t Util_ListIsEmpty(const List_t *const List_p)
+{
+ ListStatus_t Result;
+
+ PRE_CONDITION(List_p != NULL, return LIST_STATUS_INVALID_LIST);
+
+ if (List_p->Head_p == NULL)
+ Result = LIST_STATUS_LIST_EMPTY;
+ else
+ Result = LIST_STATUS_NOTHING_TO_REPORT;
+
+ C_(printf("\nUtil_ListIsEmpty: %d, List = 0x%x", Result, (int)List_p);)
+ return Result;
+}
+#endif
+/*
+ * NAME
+ * Util_EListInsertBefore
+ *
+ */
+#ifndef REMOVE_UF_ELISTINSERTBEFORE
+
+ListResult_t Util_EListInsertBefore(List_t *const List_p,
+ const void *const Key_p,
+ void *const ElemContent_p)
+{
+ ListItem_t *ListItem_p;
+
+
+ PRE_CONDITION(List_p != NULL, return LIST_ERROR_INVALID_LIST);
+
+
+ ListItem_p =
+ (ListItem_t *)(*List_p->MemAllocFunc_p)(sizeof(ListItem_t));
+ if (ListItem_p == NULL) {
+ B_(printf(
+ "\nUtil_EListInsertBefore:\n LIST_ERROR_COULD_NOT_ALLOC_MEM for Element_p = 0x%x, Key_p = 0x%x, List_p = 0x%x",
+ (int)ElemContent_p, (int)Key_p, (int)List_p);)
+ return LIST_ERROR_COULD_NOT_ALLOC_MEM;
+ }
+
+ ListItem_p->EKey_p = Key_p;
+ ListItem_p->Body_p = ElemContent_p;
+
+ List_p->NbrOfElements++;
+
+ if (List_p->Curr_p == NULL) {
+ /* list is empty or we're off the list,
+ add item at the head of the list */
+ /* and set the current pointer to point
+ to the newly added element */
+ ListItem_p->Next_p = List_p->Head_p;
+
+ if (List_p->Head_p == NULL)
+ List_p->Tail_p = ListItem_p;
+ else
+ List_p->Head_p->Prev_p = ListItem_p;
+
+ ListItem_p->Prev_p = NULL;
+ List_p->Head_p = ListItem_p;
+ List_p->Curr_p = ListItem_p;
+ } else {
+ if (List_p->Curr_p->Prev_p == NULL) {
+ /* The current pointer points to the head of the list */
+ List_p->Head_p->Prev_p = ListItem_p;
+ ListItem_p->Prev_p = NULL;
+ ListItem_p->Next_p = List_p->Head_p;
+ List_p->Head_p = ListItem_p;
+ List_p->Curr_p = ListItem_p;
+ } else {
+ ListItem_p->Prev_p = List_p->Curr_p->Prev_p;
+ ListItem_p->Next_p = List_p->Curr_p;
+ List_p->Curr_p->Prev_p->Next_p = ListItem_p;
+ List_p->Curr_p->Prev_p = ListItem_p;
+ List_p->Curr_p = ListItem_p;
+ }
+ }
+ C_(printf(
+ "\nUtil_EListInsertBefore:\n LIST_SUCCESS for Element_p = 0x%x, Key_p = 0x%x, List_p = 0x%x",
+ (int)ElemContent_p, (int)Key_p, (int)List_p);)
+ return LIST_SUCCESS;
+}
+
+#endif /* REMOVE_UF_ELISTINSERTBEFORE */
+
+
+/*
+ * NAME
+ * Util_ListInsertFirst
+ *
+ */
+#ifndef REMOVE_UF_LISTINSERTFIRST
+
+ListResult_t Util_ListInsertFirst(List_t *const List_p,
+ const void *const Key_p,
+ void *const ElemContent_p)
+{
+ ListItem_t *ListItem_p;
+
+ PRE_CONDITION(List_p != NULL, return LIST_ERROR_INVALID_LIST);
+
+
+ ListItem_p =
+ (ListItem_t *)(*List_p->MemAllocFunc_p)(sizeof(ListItem_t));
+ if (ListItem_p == NULL) {
+ B_(printf(
+ "\nUtil_EListInsertBefore:\n LIST_ERROR_COULD_NOT_ALLOC_MEM for Element_p = 0x%x, Key_p = 0x%x, List_p = 0x%x",
+ (int)ElemContent_p, (int)Key_p, (int)List_p);)
+ return LIST_ERROR_COULD_NOT_ALLOC_MEM;
+ }
+
+ ListItem_p->EKey_p = Key_p;
+ ListItem_p->Body_p = ElemContent_p;
+ List_p->NbrOfElements++;
+
+
+ ListItem_p->Next_p = List_p->Head_p;
+
+ if (List_p->Head_p == NULL) {
+ /* list is empty */
+ List_p->Tail_p = ListItem_p;
+ } else {
+ /* list is not empty, link element at the head */
+ List_p->Head_p->Prev_p = ListItem_p;
+ }
+ ListItem_p->Prev_p = NULL;
+ List_p->Head_p = ListItem_p;
+
+ C_(printf(
+ "\nUtil_ListInsertFirst:\n LIST_SUCCESS for Element_p = 0x%x, Key_p = 0x%x, List_p = 0x%x",
+ (int)ElemContent_p, (int)Key_p, (int)List_p);)
+ return LIST_SUCCESS;
+}
+#endif /* REMOVE_UF_LISTINSERTFIRST */
+
+
+/*
+ * NAME
+ * Util_EListInsertAfter
+ *
+ */
+#ifndef REMOVE_UF_ELISTINSERTAFTER
+
+ListResult_t Util_EListInsertAfter(List_t *const List_p,
+ const void *const Key_p,
+ void *const ElemContent_p)
+{
+ ListItem_t *ListItem_p;
+
+ PRE_CONDITION(List_p != NULL, return LIST_ERROR_INVALID_LIST);
+
+ ListItem_p =
+ (ListItem_t *)(*List_p->MemAllocFunc_p)(sizeof(ListItem_t));
+ if (ListItem_p == NULL) {
+ B_(printf(
+ "\nUtil_EListInsertAfter:\n LIST_ERROR_COULD_NOT_ALLOC_MEM for Element = 0x%x, Key_p = 0x%x, List = 0x%x",
+ (int)ElemContent_p, (int)Key_p, (int)List_p);)
+ return LIST_ERROR_COULD_NOT_ALLOC_MEM;
+ }
+
+ ListItem_p->EKey_p = Key_p;
+ ListItem_p->Body_p = ElemContent_p;
+
+ List_p->NbrOfElements++;
+
+ if (List_p->Curr_p == NULL) {
+ /* list is empty or we're off the list,
+ add item at the tail of the list */
+ ListItem_p->Prev_p = List_p->Tail_p;
+ if (List_p->Head_p == NULL)
+ List_p->Head_p = ListItem_p;
+ else
+ List_p->Tail_p->Next_p = ListItem_p;
+
+ ListItem_p->Next_p = NULL;
+ List_p->Tail_p = ListItem_p;
+ List_p->Curr_p = ListItem_p;
+ } else {
+ if (List_p->Curr_p->Next_p == NULL) {
+ List_p->Tail_p->Next_p = ListItem_p;
+ ListItem_p->Next_p = NULL;
+ ListItem_p->Prev_p = List_p->Tail_p;
+ List_p->Tail_p = ListItem_p;
+ List_p->Curr_p = ListItem_p;
+ } else {
+ ListItem_p->Next_p = List_p->Curr_p->Next_p;
+ ListItem_p->Prev_p = List_p->Curr_p;
+ List_p->Curr_p->Next_p->Prev_p = ListItem_p;
+ List_p->Curr_p->Next_p = ListItem_p;
+ List_p->Curr_p = ListItem_p;
+ }
+ }
+ C_(printf(
+ "\nUtil_EListInsertAfter:\n LIST_SUCCESS for Element_p = 0x%x, Key_p = 0x%x, List_p = 0x%x",
+ (int)ElemContent_p, (int)Key_p, (int)List_p);)
+ return LIST_SUCCESS;
+}
+#endif /* REMOVE_UF_ELISTINSERTAFTER */
+
+
+/*
+ * NAME
+ * Util_ListInsertLast
+ *
+ */
+#ifndef REMOVE_UF_LISTINSERTLAST
+
+ListResult_t Util_ListInsertLast(List_t *const List_p,
+ const void *const Key_p,
+ void *const ElemContent_p)
+{
+ ListItem_t *ListItem_p;
+
+ PRE_CONDITION(List_p != NULL, return LIST_ERROR_INVALID_LIST);
+
+
+ ListItem_p =
+ (ListItem_t *)(*List_p->MemAllocFunc_p)(sizeof(ListItem_t));
+ if (ListItem_p == NULL) {
+ B_(printf(
+ "\nUtil_ListInsertLast:\n LIST_ERROR_COULD_NOT_ALLOC_MEM for Element = 0x%x, Key_p = 0x%x, List = 0x%x",
+ (int)ElemContent_p, (int)Key_p, (int)List_p);)
+ return LIST_ERROR_COULD_NOT_ALLOC_MEM;
+ }
+
+ ListItem_p->EKey_p = Key_p;
+ ListItem_p->Body_p = ElemContent_p;
+
+ List_p->NbrOfElements++;
+
+ /* Insert the element at the tail of the list */
+ ListItem_p->Prev_p = List_p->Tail_p;
+ if (List_p->Head_p == NULL) {
+ /* list is empty */
+ List_p->Head_p = ListItem_p;
+ } else {
+ /* list is not empty, link element at the tail */
+ List_p->Tail_p->Next_p = ListItem_p;
+ }
+
+ ListItem_p->Next_p = NULL;
+ List_p->Tail_p = ListItem_p;
+
+ C_(printf(
+ "\nUtil_ListInsertLast:\n LIST_SUCCESS for Element_p = 0x%x, Key_p = 0x%x, List_p = 0x%x",
+ (int)ElemContent_p, (int)Key_p, (int)List_p);)
+ return LIST_SUCCESS;
+}
+#endif /* REMOVE_UF_LISTINSERTLAST */
+
+
+/*
+ * NAME
+ * Util_ListGotoTail
+ *
+ */
+#ifndef REMOVE_UF_LISTGOTOTAIL
+#ifdef REMOVE_UF_LISTCURR
+#undef REMOVE_UF_LISTCURR
+#endif
+void *Util_ListGotoTail(List_t *const List_p)
+{
+ PRE_CONDITION(List_p != NULL, return NULL);
+
+ List_p->Curr_p = List_p->Tail_p;
+ C_(printf("\nUtil_ListGotoTail: List = 0x%x", (int)List_p);)
+ return Util_ListCurr(List_p);
+}
+#endif /* REMOVE_UF_LISTGOTOTAIL */
+
+#ifndef REMOVE_UF_LISTRESETCURR
+bool Util_ListResetCurr(List_t *const List_p)
+{
+ PRE_CONDITION(List_p != NULL, return false);
+
+ List_p->Curr_p = NULL;
+ C_(printf("\nUtil_ListResetCurr: List = 0x%x", (int)List_p);)
+ return true;
+}
+#endif /* REMOVE_UF_LISTRESETCURR */
+
+/*
+ * NAME
+ * Util_ListGotoHead
+ *
+ */
+#ifndef REMOVE_UF_LISTGOTOHEAD
+#ifdef REMOVE_UF_LISTCURR
+#undef REMOVE_UF_LISTCURR
+#endif
+void *Util_ListGotoHead(List_t *const List_p)
+{
+ PRE_CONDITION(List_p != NULL, return NULL);
+
+ List_p->Curr_p = List_p->Head_p;
+ C_(printf("\nUtil_ListGotoHead: List = 0x%x", (int)List_p);)
+ return Util_ListCurr(List_p);
+}
+#endif /* REMOVE_UF_LISTGOTOHEAD */
+
+
+/*
+ * NAME
+ * Util_ListGotoIth
+ *
+ */
+#ifndef REMOVE_UF_LISTGOTOITH
+#ifdef REMOVE_UF_LISTCURR
+#undef REMOVE_UF_LISTCURR
+#endif
+void *Util_ListGotoIth(List_t *const List_p, uint16_t i)
+{
+ PRE_CONDITION((List_p != NULL) && (i >= 1), return NULL);
+
+ List_p->Curr_p = List_p->Head_p;
+ while ((List_p->Curr_p != NULL) && (i > 1)) {
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+ i--;
+ }
+ C_(printf("\nUtil_ListGotoIth: list 0x%x pointing to the %dth element",
+ (int)List_p, i);)
+ return Util_ListCurr(List_p);
+}
+#endif /* REMOVE_UF_LISTGOTOITH */
+
+
+/*
+ * NAME
+ * Util_ListIsNext
+ */
+#ifndef REMOVE_UF_LISTISNEXT
+#ifdef REMOVE_UF_LISTSTATUS
+#undef REMOVE_UF_LISTSTATUS
+#endif
+bool Util_ListIsNext(List_t *const List_p)
+{
+ ListStatus_t Status;
+
+ Status = Util_ListStatus(List_p);
+ if (Status &
+ (LIST_STATUS_PTR_TO_TAIL |
+ LIST_STATUS_LIST_EMPTY |
+ LIST_STATUS_INVALID_LIST)
+ ) {
+ return false;
+ } else {
+ if (Status & LIST_STATUS_PTR_OFF_LIST)
+ List_p->Curr_p = List_p->Head_p;
+ else
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+
+ return true;
+ }
+}
+#endif
+
+/*
+ * NAME
+ * Util_ListIsPrev
+ */
+#ifndef REMOVE_UF_LISTISPREV
+#ifdef REMOVE_UF_LISTSTATUS
+#undef REMOVE_UF_LISTSTATUS
+#endif
+bool Util_ListIsPrev(List_t *const List_p)
+{
+ ListStatus_t Status;
+
+ Status = Util_ListStatus(List_p);
+ if (Status &
+ (LIST_STATUS_PTR_TO_HEAD |
+ LIST_STATUS_LIST_EMPTY |
+ LIST_STATUS_INVALID_LIST)
+ ) {
+ return false;
+ } else {
+ if (Status & LIST_STATUS_PTR_OFF_LIST)
+ List_p->Curr_p = List_p->Tail_p;
+ else
+ List_p->Curr_p = List_p->Curr_p->Prev_p;
+
+ return true;
+ }
+}
+#endif
+
+/*
+ * NAME
+ * Util_ListStatus
+ *
+ */
+#ifndef REMOVE_UF_LISTSTATUS
+ListStatus_t Util_ListStatus(const List_t *const List_p)
+{
+ ListStatus_t Result = LIST_STATUS_NOTHING_TO_REPORT; /* = 0 */
+
+ PRE_CONDITION(List_p != NULL, return LIST_STATUS_INVALID_LIST);
+
+ if (List_p->Head_p == NULL) {
+ Result = LIST_STATUS_LIST_EMPTY;
+ } else if (List_p->Curr_p == NULL) {
+ Result = LIST_STATUS_PTR_OFF_LIST;
+ } else {
+ if (List_p->Curr_p->Next_p == NULL)
+ Result = LIST_STATUS_PTR_TO_TAIL;
+
+ if (List_p->Curr_p->Prev_p == NULL)
+ Result |= LIST_STATUS_PTR_TO_HEAD;
+
+ }
+ C_(printf("\nUtil_ListStatus: %d, List = 0x%x", Result, (int)List_p);)
+ return Result;
+}
+#endif /* REMOVE_UF_LISTSTATUS */
+
+
+/*
+ * NAME
+ * Util_ListNext
+ *
+ */
+#ifndef REMOVE_UF_LISTNEXT
+#ifdef REMOVE_UF_LISTCURR
+#undef REMOVE_UF_LISTCURR
+#endif
+void *Util_ListNext(List_t *const List_p)
+{
+ PRE_CONDITION(List_p != NULL, return NULL);
+
+ if (List_p->Curr_p == NULL) {
+ if (List_p->Head_p == NULL) {
+ B_(printf("\nUtil_ListNext: List = 0x%x is empty",
+ (int)List_p);)
+ return NULL;
+ } else {
+ List_p->Curr_p = List_p->Head_p;
+ }
+ } else {
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+ }
+ return Util_ListCurr(List_p);
+}
+#endif /* REMOVE_UF_LISTNEXT */
+
+
+/*
+ * NAME
+ * Util_ListPrev
+ *
+ */
+#ifndef REMOVE_UF_LISTPREV
+#ifdef REMOVE_UF_LISTCURR
+#undef REMOVE_UF_LISTCURR
+#endif
+void *Util_ListPrev(List_t *const List_p)
+{
+ PRE_CONDITION(List_p != NULL, return NULL);
+
+ if (List_p->Curr_p == NULL) {
+ if (List_p->Head_p == NULL) {
+ B_(printf("\nUtil_ListPrev: List = 0x%x is empty",
+ (int)List_p);)
+ return NULL;
+ } else {
+ List_p->Curr_p = List_p->Tail_p;
+ }
+ } else {
+ List_p->Curr_p = List_p->Curr_p->Prev_p;
+ }
+
+ return Util_ListCurr(List_p);
+}
+#endif /* REMOVE_UF_LISTPREV */
+
+
+/*
+ * NAME
+ * Util_ListKeyedRemove
+ *
+ */
+#ifndef REMOVE_UF_LISTKEYEDREMOVE
+#ifdef REMOVE_UF_LISTREMOVE
+#undef REMOVE_UF_LISTREMOVE
+#endif
+
+ListResult_t Util_ListKeyedRemove(List_t *const List_p,
+ const void *const Key_p,
+ const ListKeyMatchingFunction_t
+ KeyMatchingFunc_p)
+{
+ PRE_CONDITION((List_p != NULL) && (Key_p != NULL),
+ return LIST_ERROR_INVALID_PARAM);
+
+ /* Make sure the list is not empty */
+ if (List_p->Head_p == NULL) {
+ return LIST_ERROR_NO_MATCH_FOUND;
+ } else {
+ /* the "current" item in the list at
+ the time the function is entered */
+ ListItem_t *Temp_p;
+ /* Last element of the list that
+ should be checked for a matchhing key */
+ ListItem_t *LastElement_p;
+ ListKeyMatchingFunction_t ComparisonFunc_p;
+
+ Temp_p = List_p->Curr_p;
+ LastElement_p = Temp_p;
+
+ if (List_p->Curr_p == NULL) {
+ List_p->Curr_p = List_p->Head_p;
+ LastElement_p = List_p->Head_p;
+ }
+
+ if (KeyMatchingFunc_p == NULL)
+ ComparisonFunc_p = ListIntComparisonFunc;
+ else
+ ComparisonFunc_p = KeyMatchingFunc_p;
+
+ do {
+ if (List_p->Curr_p->EKey_p != NULL) {
+ if ((*ComparisonFunc_p)(List_p->Curr_p->EKey_p,
+ Key_p)) {
+ C_(printf(
+ "\nUtil_ListKeyedRemove: Found a match, List = 0x%x",
+ (int)List_p);)
+ return Util_ListRemove(List_p);
+ }
+ }
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+ /* wrap around */
+ if (List_p->Curr_p == NULL)
+ List_p->Curr_p = List_p->Head_p;
+
+ } while (List_p->Curr_p != LastElement_p);
+
+ C_(printf("\nUtil_ListKeyedRemove: NULL, List = 0x%x",
+ (int)List_p);)
+ List_p->Curr_p = Temp_p;
+
+ return LIST_ERROR_NO_MATCH_FOUND;
+ }
+}
+#endif /* REMOVE_UF_LISTKEYEDREMOVE */
+
+/*
+ * NAME
+ * Util_EListMatchingKey
+ *
+ */
+#ifndef REMOVE_UF_ELISTMATCHINGKEY
+#ifdef REMOVE_UF_LISTCURR
+#undef REMOVE_UF_LISTCURR
+#endif
+
+void *Util_EListMatchingKey(List_t *const List_p,
+ const void *const Key_p,
+ const ListKeyMatchingFunction_t KeyMatchingFunc_p)
+{
+ PRE_CONDITION((List_p != NULL) && (Key_p != NULL), return NULL);
+
+ /* Make sure the list is not empty */
+ if (List_p->Head_p == NULL) {
+ return NULL;
+ } else {
+ /* the "current" item in the
+ list at the time the function is entered */
+ ListItem_t *Temp_p;
+ /* Last element of the list
+ that should be checked for a matchhing key */
+ ListItem_t *LastElement_p;
+ ListKeyMatchingFunction_t ComparisonFunc_p;
+
+ Temp_p = List_p->Curr_p;
+ LastElement_p = Temp_p;
+
+ if (List_p->Curr_p == NULL) {
+ List_p->Curr_p = List_p->Head_p;
+ LastElement_p = List_p->Head_p;
+ }
+
+ if (KeyMatchingFunc_p == NULL)
+ ComparisonFunc_p = ListIntComparisonFunc;
+ else
+ ComparisonFunc_p = KeyMatchingFunc_p;
+
+ do {
+ if (List_p->Curr_p->EKey_p != NULL) {
+ if ((*ComparisonFunc_p)(List_p->Curr_p->EKey_p,
+ Key_p)) {
+ C_(printf(
+ "\nUtil_EListMatchingKey: Found a match, List = 0x%x",
+ (int)List_p);)
+ return Util_ListCurr(List_p);
+ }
+ }
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+ /* wrap around */
+ if (List_p->Curr_p == NULL)
+ List_p->Curr_p = List_p->Head_p;
+
+ } while (List_p->Curr_p != LastElement_p);
+
+ C_(printf("\nUtil_EListMatchingKey: NULL, List = 0x%x",
+ (int)List_p);)
+ List_p->Curr_p = Temp_p;
+ return NULL;
+ }
+}
+
+#endif /* REMOVE_UF_ELISTMATCHINGKEY */
+
+/*
+ * NAME
+ * Util_EListMatchingKeyClientHandleStyle
+ *
+ */
+#ifndef REMOVE_UF_ELISTMATCHINGKEYREMOVECLIENTHANDLESTYLE
+#ifdef REMOVE_UF_LISTCURR
+#undef REMOVE_UF_LISTCURR
+#endif
+
+void *Util_EListMatchingKeyClientHandleStyle(List_t *const List_p,
+ const void *const Key_p,
+ const ListKeyMatchingFunctionClientHandleStyle_t
+ KeyMatchingFunc_p)
+{
+ PRE_CONDITION((NULL != List_p) && (NULL != Key_p), return NULL);
+
+ /* Make sure the list is not empty */
+ if (NULL == List_p->Head_p) {
+ return NULL;
+ } else {
+ /* the "current" item in the
+ list at the time the function is entered */
+ ListItem_t *Temp_p;
+ /* Last element of the list
+ that should be checked for a matchhing key */
+ ListItem_t *LastElement_p;
+
+ Temp_p = List_p->Curr_p;
+ LastElement_p = Temp_p;
+
+ if (NULL == List_p->Curr_p) {
+ List_p->Curr_p = List_p->Head_p;
+ LastElement_p = List_p->Head_p;
+ }
+
+ do {
+ if (NULL != List_p->Curr_p->EKey_p) {
+ if ((*KeyMatchingFunc_p)(List_p->ClientHandle_p,
+ List_p->Curr_p->EKey_p,
+ Key_p)) {
+ C_(printf(
+ "\nUtil_EListMatchingKey: Found a match, List = 0x%x",
+ (int)List_p);)
+ return Util_ListCurr(List_p);
+ }
+ }
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+ /* wrap around */
+ if (List_p->Curr_p == NULL)
+ List_p->Curr_p = List_p->Head_p;
+
+ } while (List_p->Curr_p != LastElement_p);
+
+ C_(printf("\nUtil_EListMatchingKey: NULL, List = 0x%x",
+ (int)List_p);)
+ List_p->Curr_p = Temp_p;
+ return NULL;
+ }
+}
+#endif /* REMOVE_UF_ELISTMATCHINGKEYREMOVECLIENTHANDLESTYLE */
+
+/*
+ * NAME
+ * Util_ListKeyedIndex
+ *
+ */
+#ifndef REMOVE_UF_LISTKEYEDINDEX
+
+int Util_ListKeyedIndex(List_t *const List_p,
+ const void *const Key_p,
+ const ListKeyMatchingFunction_t KeyMatchingFunc_p)
+{
+ PRE_CONDITION((List_p != NULL) && (Key_p != NULL), return -1);
+
+ /* Make sure the list is not empty */
+ if (List_p->Head_p == NULL) {
+ return -1;
+ } else {
+ /* the "current" item in the
+ list at the time the function is entered */
+ ListItem_t *Temp_p;
+
+ ListKeyMatchingFunction_t ComparisonFunc_p;
+ int PositionInList;
+
+ if (KeyMatchingFunc_p == NULL)
+ ComparisonFunc_p = ListIntComparisonFunc;
+ else
+ ComparisonFunc_p = KeyMatchingFunc_p;
+
+ Temp_p = List_p->Curr_p;
+ List_p->Curr_p = List_p->Head_p;
+ PositionInList = 1;
+ do {
+ if (List_p->Curr_p->EKey_p != NULL) {
+ if ((*ComparisonFunc_p)(List_p->Curr_p->EKey_p,
+ Key_p)) {
+ C_(printf(
+ "\nUtil_ListKeyedIndex: Found, List = 0x%x",
+ (int)List_p);)
+ return PositionInList;
+ }
+ }
+ PositionInList++;
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+ } while (List_p->Curr_p != NULL);
+
+ C_(printf("\nUtil_ListKeyedIndex: Not Found, List = 0x%x",
+ (int)List_p);)
+ List_p->Curr_p = Temp_p;
+ return -1;
+ }
+}
+
+#endif /* REMOVE_UF_LISTKEYEDINDEX */
+
+
+/*
+ * NAME
+ * Util_ListCurrIndex
+ *
+ */
+#ifndef REMOVE_UF_LISTCURRINDEX
+
+int Util_ListCurrIndex(const List_t *const List_p)
+{
+ if (List_p == NULL || List_p->Curr_p == NULL || List_p->Head_p ==
+ NULL) {
+ B_(printf(
+ "\nUtil_ListKeyedIndex: invalid input parameters, \n List = 0x%x",
+ (int)List_p);)
+ return -1;
+ }
+
+ /* the "current" item in the
+ list at the time the function is entered */
+ ListItem_t *Temp_p;
+
+ int PositionInList;
+
+ Temp_p = List_p->Head_p;
+ PositionInList = 1;
+
+ while (Temp_p != List_p->Curr_p && Temp_p != NULL) {
+ PositionInList++;
+ Temp_p = Temp_p->Next_p;
+ }
+ if (Temp_p == List_p->Curr_p) {
+ C_(printf("\nUtil_ListCurrIndex: Found, List = 0x%x",
+ (int)List_p);)
+ return PositionInList;
+ } else {
+ C_(printf("\nUtil_ListCurrIndex: Not Found, List = 0x%x",
+ (int)List_p);)
+ return -1;
+ }
+}
+
+#endif /* REMOVE_UF_LISTCURRINDEX */
+
+
+
+#ifndef REMOVE_UF_LISTMOVESUBRANGE
+
+ListResult_t Util_ListMoveSubrange(List_t *const List_p,
+ uint16_t First,
+ uint16_t Last,
+ uint16_t To)
+{
+ ListItem_t *First_p;
+ ListItem_t *Last_p;
+
+ ListItem_t *After_p;
+ ListItem_t *BeforeFirst_p;
+ uint16_t DeltaIndexToNext;
+ ListItem_t *To_p = NULL;
+
+ First--;
+ Last--;
+ To--;
+
+ PRE_CONDITION((List_p != NULL) &&
+ ((First > To) || (To > Last)) && (First <= Last),
+ return LIST_ERROR_INVALID_PARAM);
+
+ if (To < First) {
+ To_p = List_p->Head_p;
+ if (!ListMoveForward(To, &To_p))
+ return LIST_ERROR_INVALID_PARAM;
+
+ DeltaIndexToNext = First - To;
+ First_p = To_p;
+ } else {
+ DeltaIndexToNext = First;
+ First_p = List_p->Head_p;
+ }
+
+
+ if (!ListMoveForward(DeltaIndexToNext, &First_p))
+ return LIST_ERROR_INVALID_PARAM;
+
+ DeltaIndexToNext = Last - First;
+ Last_p = First_p;
+ if (!ListMoveForward(DeltaIndexToNext, &Last_p))
+ return LIST_ERROR_INVALID_PARAM;
+
+ if (To > Last) {
+ DeltaIndexToNext = To - Last;
+ To_p = Last_p;
+ if (!ListMoveForward(DeltaIndexToNext, &To_p))
+ return LIST_ERROR_INVALID_PARAM;
+ }
+
+ /* Patch the hole left after removing the
+ elements from first to last. */
+ BeforeFirst_p = First_p->Prev_p;
+ After_p = Last_p->Next_p;
+ if (BeforeFirst_p != NULL) {
+ BeforeFirst_p->Next_p = After_p;
+ } else {
+ /* The head of the list pointed to
+ First_p before the call, */
+ /* It should now point to the first
+ element after Last_p */
+ List_p->Head_p = After_p;
+ }
+
+ if (After_p != NULL) {
+ After_p->Prev_p = BeforeFirst_p;
+ } else {
+ /* The tail of the list pointed to Last_p before the call, */
+ /* It should now point to the element
+ before the first element removed */
+ List_p->Tail_p = BeforeFirst_p;
+ }
+
+ /* Insert the removed elements after the element pointed to by To_p */
+ if (To_p != NULL) {
+ After_p = To_p->Next_p;
+
+ To_p->Next_p = First_p;
+ First_p->Prev_p = To_p;
+ }
+ Last_p->Next_p = After_p;
+ if (After_p != NULL) {
+ After_p->Prev_p = Last_p;
+ } else {
+ /* The tail of the list pointed to To_p prior to the call, */
+ /* The tail of the list becomes the last element moved */
+ List_p->Tail_p = Last_p;
+ }
+
+ List_p->Curr_p = NULL;
+
+ C_(printf(
+ "\nUtil_ListMoveSub: Reordered elements in list OK, List = 0x%x",
+ (int)List_p);)
+ return LIST_SUCCESS;
+}
+#endif /* REMOVE_UF_LISTMOVESUBRANGE */
+
+
+#ifndef REMOVE_UF_LISTGETSUBRANGE
+
+ListResult_t Util_ListGetSubrange(List_t *const FromList_p,
+ uint16_t First,
+ uint16_t Last,
+ List_t *const ToList_p)
+{
+ ListItem_t *First_p;
+ ListItem_t *Last_p;
+ ListItem_t *BeforeFirst_p;
+ ListItem_t *AfterLast_p;
+ uint16_t NbrOfElementsToMove;
+
+ First--;
+ Last--;
+
+ PRE_CONDITION((FromList_p != NULL) && (ToList_p != NULL) &&
+ (First <= Last),
+ return LIST_ERROR_INVALID_PARAM);
+
+ NbrOfElementsToMove = Last + 1 - First;
+
+ First_p = FromList_p->Head_p;
+ if (!ListMoveForward(First, &First_p))
+ return LIST_ERROR_INVALID_PARAM;
+
+ Last -= First;
+ Last_p = First_p;
+ if (!ListMoveForward(Last, &Last_p))
+ return LIST_ERROR_INVALID_PARAM;
+
+ /* relink the elements in FromList_p */
+ BeforeFirst_p = First_p->Prev_p;
+ AfterLast_p = Last_p->Next_p;
+ if (BeforeFirst_p != NULL) {
+ BeforeFirst_p->Next_p = AfterLast_p;
+ } else {
+ /* The head of the list pointed to
+ First_p before the call, */
+ /* It should now point to the first
+ element after Last_p */
+ FromList_p->Head_p = AfterLast_p;
+ }
+
+ if (AfterLast_p != NULL) {
+ AfterLast_p->Prev_p = BeforeFirst_p;
+ } else {
+ /* The tail of the list pointed to
+ Last_p before the call, */
+ /* It should now point to the element
+ before the first element removed */
+ FromList_p->Tail_p = BeforeFirst_p;
+ }
+
+ ToList_p->NbrOfElements += NbrOfElementsToMove;
+ FromList_p->NbrOfElements -= NbrOfElementsToMove;
+
+ /* Initialize the ToList */
+ if (ToList_p->Tail_p == NULL) {
+ /* ToList_p is empty, First_p becomes
+ the head and Last_p becomes the tail */
+ ToList_p->Head_p = First_p;
+ First_p->Prev_p = NULL;
+
+ ToList_p->Tail_p = Last_p;
+ Last_p->Next_p = NULL;
+ } else {
+ /* Link the elements removed from
+ FromList_p to the tail of ToList_p */
+ ToList_p->Tail_p->Next_p = First_p;
+ First_p->Prev_p = ToList_p->Tail_p;
+
+ ToList_p->Tail_p = Last_p;
+ Last_p->Next_p = NULL;
+ }
+
+ /* The current pointer in FromList_p and ToList_p are reset. */
+ ToList_p->Curr_p = NULL;
+ FromList_p->Curr_p = NULL;
+
+ C_(printf("\nUtil_ListGetSubrange: OK, ToList = 0x%x", (int)ToList_p);)
+ return LIST_SUCCESS;
+}
+#endif /* REMOVE_UF_LISTGETSUBRANGE */
+
+/*
+ * NAME
+ * Util_ListCurr
+ *
+ */
+#ifndef REMOVE_UF_LISTCURR
+void *Util_ListCurr(const List_t *const List_p)
+{
+ PRE_CONDITION(List_p != NULL, return NULL);
+
+ if (List_p->Curr_p == NULL) {
+ C_(printf(
+ "\nUtil_ListCurrent: list element pointer is NULL, List = 0x%x",
+ (int)List_p);)
+ return NULL;
+ } else {
+ C_(printf(
+ "\nUtil_ListCurrent: list element pointer is 0x%x, List = 0x%x",
+ (int)List_p->Curr_p->Body_p, (int)List_p);)
+ return List_p->Curr_p->Body_p;
+ }
+}
+#endif /* REMOVE_UF_LISTCURR */
+
+/*
+ * NAME
+ * Util_ListDestroy
+ *
+ */
+#ifndef REMOVE_UF_LISTDESTROY
+#ifdef REMOVE_UF_LISTDELETE
+#undef REMOVE_UF_LISTDELETE
+#endif
+ListResult_t Util_ListDestroy(List_t **List_pp,
+ const ListDeleteFunction_t DelFunc_p)
+{
+ ListResult_t Result = LIST_SUCCESS;
+ List_t *List_p = *List_pp;
+
+ PRE_CONDITION(List_p != NULL, return LIST_ERROR_INVALID_LIST);
+
+ /* traverse the list from the head */
+ List_p->Curr_p = List_p->Head_p;
+
+ while ((List_p->Curr_p != NULL) && (Result == LIST_SUCCESS))
+ Result = Util_ListDelete(List_p, DelFunc_p);
+
+ if (Result == LIST_SUCCESS) {
+ (*List_p->MemFreeFunc_p)(List_p);
+ *List_pp = NULL;
+ }
+ C_(printf("\nUtil_ListDestroy: Return = %d, List = 0x%x is destroyed",
+ Result, (int)List_p);)
+ return Result;
+}
+#endif /* REMOVE_UF_LISTDESTROY */
+
+/*
+ * NAME
+ * Util_ListDestroyGeneralMap
+ * special attention for the delete function callback due to general map.
+ * General map allows seperate allocation for key and value therefore must
+ * the callback include both these parameters
+ */
+#ifndef REMOVE_UF_LISTDESTROYGENERALMAP
+#ifdef REMOVE_UF_LISTDELETEGENERALMAP
+#undef REMOVE_UF_LISTDELETEGENERALMAP
+#endif
+ListResult_t Util_ListDestroyGeneralMap(List_t **List_pp,
+ const ListDeleteFunctionGeneralMap_t DelFunc_p)
+{
+ ListResult_t Result = LIST_SUCCESS;
+ List_t *List_p = *List_pp;
+
+ PRE_CONDITION(NULL != List_p, return LIST_ERROR_INVALID_LIST);
+
+ /* traverse the list from the head */
+ List_p->Curr_p = List_p->Head_p;
+
+ while ((NULL != List_p->Curr_p) && (LIST_SUCCESS == Result))
+ Result = Util_ListDeleteGeneralMap(List_p, DelFunc_p);
+
+ if (LIST_SUCCESS == Result) {
+ (*List_p->MemFreeFunc_p)(List_p);
+ *List_pp = NULL;
+ }
+ C_(printf("\nUtil_ListDestroy: Return = %d, List = 0x%x is destroyed",
+ Result, (int)List_p);)
+ return Result;
+}
+#endif /* REMOVE_UF_LISTDESTROYGENERALMAP */
+
+/*
+ * NAME
+ * Util_ListDestroyGeneralMap
+ * Special attention to ClientHandle style with client handler in callbacks
+ */
+#ifndef REMOVE_UF_LISTDESTROYGENERALMAPCLIENTHANDLESTYLE
+#ifdef REMOVE_UF_LISTDELETEGENERALMAPCLIENTHANDLESTYLE
+#undef REMOVE_UF_LISTDELETEGENERALMAPCLIENTHANDLESTYLE
+#endif
+ListResult_t Util_ListDestroyGeneralMapClientHandleStyle(List_t **List_pp,
+ const ListDeleteFunctionGeneralMapClientHandleStyle_t DelFunc_p)
+{
+ ListResult_t Result = LIST_SUCCESS;
+ List_t *List_p = *List_pp;
+
+ PRE_CONDITION(NULL != List_p, return LIST_ERROR_INVALID_LIST);
+
+ /* traverse the list from the head */
+ List_p->Curr_p = List_p->Head_p;
+
+ while ((NULL != List_p->Curr_p) && (LIST_SUCCESS == Result))
+ Result = Util_ListDeleteGeneralMapClientHandleStyle(List_p,
+ DelFunc_p);
+
+ if (LIST_SUCCESS == Result) {
+ (*List_p->MemFreeFunc_p)(List_p);
+ *List_pp = NULL;
+ }
+ C_(printf("\nUtil_ListDestroy: Return = %d, List = 0x%x is destroyed",
+ Result, (int)List_p);)
+ return Result;
+}
+#endif /* REMOVE_UF_LISTDESTROYGENERALMAPCLIENTHANDLESTYLE */
+
+
+/*
+ * NAME
+ * Util_ListDelete
+ *
+ */
+#ifndef REMOVE_UF_LISTDELETE
+#ifdef REMOVE_UF_LISTREMOVE
+#undef REMOVE_UF_LISTREMOVE
+#endif
+ListResult_t Util_ListDelete(List_t *const List_p,
+ const ListDeleteFunction_t DelFunc_p)
+{
+ PRE_CONDITION(List_p != NULL, return LIST_ERROR_INVALID_LIST);
+
+ if (List_p->Curr_p == NULL) {
+ /* list is empty or no current element, nothing to remove */
+ B_(printf(
+ "\nUtil_ListDelete: LIST_ERROR_CURRENT_PTR_OFF_LIST, List = 0x%x is empty",
+ (int)List_p);)
+ return LIST_ERROR_CURRENT_PTR_OFF_LIST;
+ }
+
+ /* delete the element body using the application's delete callback */
+ if (DelFunc_p != NULL) {
+ C_(printf(
+ "\nUtil_ListDelete: Calling application delete function: List_p = 0x%x",
+ (int)List_p);)
+ (*(DelFunc_p)) (List_p->Curr_p->Body_p);
+ }
+
+ return Util_ListRemove(List_p);
+}
+#endif /* REMOVE_UF_LISTDELETE */
+
+/*
+ * NAME
+ * Util_ListDeleteGeneralMap
+ * Changes due to general map is propagated from destoy function
+ */
+#ifndef REMOVE_UF_LISTDELETEGENERALMAP
+#ifdef REMOVE_UF_LISTREMOVE
+#undef REMOVE_UF_LISTREMOVE
+#endif
+ListResult_t Util_ListDeleteGeneralMap(List_t *const List_p,
+ const ListDeleteFunctionGeneralMap_t DelFunc_p)
+{
+ PRE_CONDITION(NULL != List_p, return LIST_ERROR_INVALID_LIST);
+
+ if (NULL == List_p->Curr_p) {
+ /* list is empty or no current element, nothing to remove */
+ B_(printf(
+ "\nUtil_ListDelete: LIST_ERROR_CURRENT_PTR_OFF_LIST, List = 0x%x is empty",
+ (int)List_p);)
+ return LIST_ERROR_CURRENT_PTR_OFF_LIST;
+ }
+
+ /* delete the element body using the application's delete callback */
+ if (NULL != DelFunc_p) {
+ C_(printf(
+ "\nUtil_ListDelete: Calling application delete function: List_p = 0x%x",
+ (int)List_p);)
+ (*(DelFunc_p)) ((void *)List_p->Curr_p->EKey_p,
+ List_p->Curr_p->Body_p);
+ }
+
+ return Util_ListRemove(List_p);
+}
+#endif /* REMOVE_UF_LISTDELETEGENERALMAP */
+
+/*
+ * NAME
+ * Util_ListDeleteGeneralMapClientHandleStyle
+ * Changes due to general map and ClientHandle style is
+ * propagated from destoy function
+ *
+ */
+#ifndef REMOVE_UF_LISTDELETEGENERALMAPCLIENTHANDLESTYLE
+#ifdef REMOVE_UF_LISTREMOVE
+#undef REMOVE_UF_LISTREMOVE
+#endif
+ListResult_t Util_ListDeleteGeneralMapClientHandleStyle(List_t *const List_p,
+ const ListDeleteFunctionGeneralMapClientHandleStyle_t DelFunc_p)
+{
+ PRE_CONDITION(NULL != List_p, return LIST_ERROR_INVALID_LIST);
+
+ if (NULL == List_p->Curr_p) {
+ /* list is empty or no current element, nothing to remove */
+ B_(printf(
+ "\nUtil_ListDelete: LIST_ERROR_CURRENT_PTR_OFF_LIST, List = 0x%x is empty",
+ (int)List_p);)
+ return LIST_ERROR_CURRENT_PTR_OFF_LIST;
+ }
+
+ /* delete the element body using the application's delete callback */
+ if (NULL != DelFunc_p) {
+ C_(printf(
+ "\nUtil_ListDelete: Calling application delete function: List_p = 0x%x",
+ (int)List_p);)
+ (*(DelFunc_p)) (List_p->ClientHandle_p, NULL,
+ List_p->Curr_p->Body_p);
+ }
+
+ return Util_ListRemove(List_p);
+}
+#endif /* REMOVE_UF_LISTDELETEGENERALMAPCLIENTHANDLESTYLE */
+
+/*
+ * NAME
+ * Util_ListRemove
+ *
+ */
+#ifndef REMOVE_UF_LISTREMOVE
+ListResult_t Util_ListRemove(List_t *const List_p)
+{
+ PRE_CONDITION(List_p != NULL, return LIST_ERROR_INVALID_LIST);
+
+ if (List_p->Curr_p == NULL) {
+ /* list is empty or no current element, nothing to remove */
+ B_(printf(
+ "\nUtil_ListRemove: LIST_ERROR_CURRENT_PTR_OFF_LIST, List = 0x%x is empty",
+ (int)List_p);)
+ return LIST_ERROR_CURRENT_PTR_OFF_LIST;
+ }
+
+ List_p->NbrOfElements--;
+ if (List_p->Curr_p->Next_p == NULL) { /* tail?? */
+ if (List_p->Curr_p->Prev_p == NULL) { /* head?? */
+ /* list has only one element */
+ (*List_p->MemFreeFunc_p)(List_p->Curr_p);
+ List_p->Curr_p = NULL;
+ List_p->Head_p = NULL;
+ List_p->Tail_p = NULL;
+ } else {
+ /* item to be removed is at the tail of list */
+ List_p->Tail_p = List_p->Curr_p->Prev_p;
+ List_p->Tail_p->Next_p = NULL;
+ (*List_p->MemFreeFunc_p)(List_p->Curr_p);
+ List_p->Curr_p = List_p->Tail_p;
+ }
+ } else {
+ ListItem_t *Temp_p;
+
+ if (List_p->Curr_p->Prev_p == NULL) { /* head?? */
+ /* item to be removed is at the head of the list */
+ List_p->Head_p = List_p->Head_p->Next_p;
+ List_p->Head_p->Prev_p = NULL;
+ } else {
+ /* item to be removed is located in the middle
+ of the list */
+ List_p->Curr_p->Prev_p->Next_p = List_p->Curr_p->Next_p;
+ List_p->Curr_p->Next_p->Prev_p = List_p->Curr_p->Prev_p;
+ }
+
+ /* de-allocate memory and set current pointer to point
+ to next element in list. */
+ Temp_p = List_p->Curr_p->Next_p;
+ (*List_p->MemFreeFunc_p)(List_p->Curr_p);
+ List_p->Curr_p = Temp_p;
+ }
+ C_(printf(
+ "\nUtil_ListRemove: LIST_SUCCESS, Current element on List = 0x%x is removed",
+ (int)List_p);)
+
+ return LIST_SUCCESS;
+}
+#endif /* REMOVE_UF_LISTREMOVE */
+
+
+#ifndef REMOVE_UF_LISTPRINTDEBUG
+/*
+ * NAME
+ * Util_ListPrintDebug
+ *
+ */
+void Util_ListPrintDebug(List_t *const List_p,
+ const ListDebugFunction_t DbgFunc_p)
+{
+ PRE_CONDITION(List_p != NULL, C_(printf(
+ "\nInvalid List Specified");
+ ) return );
+
+ C_(printf("\nLIST STATUS:");)
+ if (List_p->Head_p == NULL) {
+ C_(printf(" Empty\n");)
+ C_(printf("DONE\n");)
+ } else {
+ ListItem_t *TempCurr_p = List_p->Curr_p;
+ uint16_t Index = 1;
+ IDENTIFIER_NOT_USED(Index); /*Removes Lint warning*/
+ if (List_p->Curr_p == NULL) {
+ C_(printf(" Off List: true");)
+ } else {
+ C_(printf(" Off List: false");)
+ }
+
+ C_(printf(" Head: 0x%x", (int)List_p->Head_p);)
+ C_(printf(" Tail: 0x%x", (int)List_p->Tail_p);)
+ C_(printf(" Current: 0x%x", (int)List_p->Curr_p);)
+ C_(printf(" NbrOfElements: %d", (int)List_p->NbrOfElements);)
+ C_(printf("\nLIST CONTENTS: ");)
+
+ List_p->Curr_p = List_p->Head_p;
+ while (List_p->Curr_p != NULL) {
+ C_(printf("\nElement number: %d", Index);)
+ Index++;
+ C_(printf("\n Element ptr: 0x%x",
+ (int)List_p->Curr_p);)
+ C_(printf("\n Contents ptr: 0x%x",
+ (int)List_p->Curr_p->Body_p);)
+ C_(printf("\n Key ptr: 0x%x\n",
+ (int)List_p->Curr_p->EKey_p);)
+ if (DbgFunc_p != NULL)
+ (*DbgFunc_p)(List_p->Curr_p->Body_p);
+
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+ }
+ C_(printf("DONE\n");)
+ List_p->Curr_p = TempCurr_p;
+ }
+}
+#endif /* REMOVE_UF_LISTPRINTDEBUG */
+
+#ifndef REMOVE_UF_LISTPRINTDEBUGGENERALMAP
+/*
+ * NAME
+ * Util_ListPrintDebugGeneralMap
+ * To comply with callforeach in general map style the callback
+ * declaration had to be modified
+ */
+void Util_ListPrintDebugGeneralMap(List_t *const List_p,
+ const ListDebugFunctionGeneralMap_t DbgFunc_p)
+{
+ PRE_CONDITION(NULL != List_p, C_(printf(
+ "\nInvalid List Specified");
+ ) return );
+
+ C_(printf("\nLIST STATUS:");)
+ if (NULL == List_p->Head_p) {
+ C_(printf(" Empty\n");)
+ C_(printf("DONE\n");)
+ } else {
+ ListItem_t *TempCurr_p = List_p->Curr_p;
+ uint16_t Index = 1;
+ IDENTIFIER_NOT_USED(Index); /* Removes Lint warning */
+ if (NULL == List_p->Curr_p) {
+ C_(printf(" Off List: true");)
+ } else {
+ C_(printf(" Off List: false");)
+ }
+
+ C_(printf(" Head: 0x%x", (int)List_p->Head_p);)
+ C_(printf(" Tail: 0x%x", (int)List_p->Tail_p);)
+ C_(printf(" Current: 0x%x", (int)List_p->Curr_p);)
+ C_(printf(" NbrOfElements: %d", (int)List_p->NbrOfElements);)
+ C_(printf("\nLIST CONTENTS: ");)
+
+ List_p->Curr_p = List_p->Head_p;
+ while (NULL != List_p->Curr_p) {
+ C_(printf("\nElement number: %d", Index);)
+ Index++;
+ C_(printf("\n Element ptr: 0x%x",
+ (int)List_p->Curr_p);)
+ C_(printf("\n Contents ptr: 0x%x",
+ (int)List_p->Curr_p->Body_p);)
+ C_(printf("\n Key ptr: 0x%x\n",
+ (int)List_p->Curr_p->EKey_p);)
+ if (NULL != DbgFunc_p)
+ (*DbgFunc_p)(NULL, List_p->Curr_p->Body_p, NULL,
+ NULL);
+
+ List_p->Curr_p = List_p->Curr_p->Next_p;
+ }
+ C_(printf("DONE\n");)
+ List_p->Curr_p = TempCurr_p;
+ }
+}
+#endif /* REMOVE_UF_LISTPRINTDEBUGGENERALMAP */
diff --git a/host/xtest/adbg/src/security_utils_hex.c b/host/xtest/adbg/src/security_utils_hex.c
new file mode 100644
index 0000000..913799c
--- /dev/null
+++ b/host/xtest/adbg/src/security_utils_hex.c
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+* 1. Includes
+*************************************************************************/
+#include <sys/param.h>
+#include <stdint.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "security_utils_hex.h"
+
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+
+/*************************************************************************
+* 2. Definition of external constants and variables
+*************************************************************************/
+
+/*************************************************************************
+* 3. File scope types, constants and variables
+*************************************************************************/
+static const char SecUtil_HexChars[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+};
+/*************************************************************************
+* 4. Declaration of file local functions
+*************************************************************************/
+
+/*************************************************************************
+* 5. Definition of external functions
+*************************************************************************/
+#if 0
+void SecBase_HexPrintBuffer(
+ const char *Prefix_p,
+ const char *Postfix_p,
+ const char *BufferName_p,
+ const void *Buffer_p,
+ size_t BufferLength
+ )
+{
+ char LineBuf[67];
+ size_t LinePos = 0;
+ const uint8 *Data_p = Buffer_p;
+ size_t n;
+ char EmptyString[] = "";
+
+ if (Prefix_p == NULL)
+ Prefix_p = EmptyString;
+ if (Postfix_p == NULL)
+ Postfix_p = EmptyString;
+
+ if (BufferName_p != NULL) {
+ DELAY_MS(5);
+ printf("%s%s: Size: %d%s", Prefix_p, BufferName_p, BufferLength,
+ Postfix_p);
+ }
+
+ /* Initialize the line buffer for a new line */
+ SEC_MEM_SET(LineBuf, ' ', sizeof(LineBuf));
+ LineBuf[sizeof(LineBuf) - 1] = '\0';
+ LinePos = 0;
+ for (n = 0; n < BufferLength; n++) {
+ char Separator;
+ char PrintableChar;
+
+ if (((n + 1) % 4) == 0)
+ Separator = ' ';
+ else
+ Separator = ':';
+
+ if (isprint(Data_p[n]))
+ PrintableChar = (char)Data_p[n];
+ else
+ PrintableChar = '.';
+
+ LineBuf[LinePos * 3 + 0] = SecBase_HexChars[Data_p[n] >> 4];
+ LineBuf[LinePos * 3 + 1] = SecBase_HexChars[Data_p[n] & 0x0F];
+ LineBuf[LinePos * 3 + 2] = Separator;
+ LineBuf[50 + LinePos] = PrintableChar;
+
+ LinePos++;
+ if (LinePos == 16) {
+ DELAY_MS(5);
+ printf("%s%s%s", Prefix_p, LineBuf, Postfix_p);
+ /* Initialize the line buffer for a new line */
+ SEC_MEM_SET(LineBuf, ' ', sizeof(LineBuf));
+ LineBuf[sizeof(LineBuf) - 1] = '\0';
+ LinePos = 0;
+ }
+ }
+ if (LinePos != 0) {
+ DELAY_MS(5);
+ printf("%s%s%s", Prefix_p, LineBuf, Postfix_p);
+ }
+ (void)fflush(stdout);
+}
+#endif
+
+#if 0
+void SecUtil_CHexPrintBuffer(
+ const char *Prefix_p,
+ const char *Postfix,
+ const void *Buffer_p,
+ size_t BufferLength
+ )
+{
+ char LineBuf[84];
+ const uint8 *Data_p = Buffer_p;
+ size_t n;
+ char EmptyString[] = "";
+ static const SecUtil_HexFormat_t HexFormat = { "0x", ", ", ", " };
+
+ if (Prefix_p == NULL)
+ Prefix_p = EmptyString;
+ if (Postfix == NULL)
+ Postfix = EmptyString;
+
+ for (n = 0; n < BufferLength; n += 16) {
+ (void)SecUtil_BufferToHex(Data_p + n, MIN(16, BufferLength - n),
+ &HexFormat,
+ LineBuf, sizeof(LineBuf));
+ DELAY_MS(5);
+ printf("%s%s%s", Prefix_p, LineBuf, Postfix);
+ }
+}
+#endif
+
+size_t SecUtil_BufferToHex(
+ const void *const Buffer_p,
+ size_t BufferLength,
+ const SecUtil_HexFormat_t *const HexFormat_p,
+ char *const Destination_p,
+ const size_t DestinationLength
+ )
+{
+ const uint8_t *Data_p = Buffer_p;
+ size_t UsedDestLength;
+ size_t n;
+ const char *ByteSeparator_p = NULL;
+ const char *GroupSeparator_p = NULL;
+ const char *BytePrefix_p = NULL;
+ size_t BytePrefixLength;
+
+ if (DestinationLength > 1)
+ Destination_p[0] = '\0';
+
+ UsedDestLength = 1;
+
+ if (HexFormat_p != NULL) {
+ BytePrefix_p = HexFormat_p->BytePrefix_p;
+ ByteSeparator_p = HexFormat_p->ByteSeparator_p;
+ GroupSeparator_p = HexFormat_p->GroupSeparator_p;
+ }
+
+ if (BytePrefix_p == NULL)
+ BytePrefix_p = "";
+
+ BytePrefixLength = strlen(BytePrefix_p);
+
+ if (ByteSeparator_p == NULL)
+ ByteSeparator_p = ":";
+
+ if (GroupSeparator_p == NULL)
+ GroupSeparator_p = " ";
+
+ /*
+ * This for loop is unnecessarily complicated due to
+ * the absense of both snprintf and strlcat
+ */
+ for (n = 0; n < BufferLength; n++) {
+ const char *Separator_p;
+ size_t SeparatorLength;
+
+ /* Establish separator for this byte and the next */
+ if (n == BufferLength - 1)
+ Separator_p = "";
+ else if ((n + 1) % 4 == 0)
+ Separator_p = GroupSeparator_p;
+ else
+ Separator_p = ByteSeparator_p;
+
+ SeparatorLength = strlen(Separator_p);
+
+ /* Insert the Byte prefix */
+ if (UsedDestLength < DestinationLength) {
+ size_t CopyLength;
+
+ CopyLength = MIN(BytePrefixLength,
+ DestinationLength - UsedDestLength);
+ memcpy(Destination_p + UsedDestLength - 1, BytePrefix_p,
+ CopyLength);
+ Destination_p[UsedDestLength - 1 + CopyLength] = '\0';
+ }
+ UsedDestLength += BytePrefixLength;
+
+ /* Insert the first nibble of the ASCII hexadecimal byte */
+ if (UsedDestLength < DestinationLength) {
+ Destination_p[UsedDestLength -
+ 1] = SecUtil_HexChars[Data_p[n] >> 4];
+ Destination_p[UsedDestLength] = '\0';
+ }
+ UsedDestLength++;
+
+ /* Insert the second nibble of the ASCII hexadecimal byte */
+ if (UsedDestLength < DestinationLength) {
+ Destination_p[UsedDestLength -
+ 1] = SecUtil_HexChars[Data_p[n] & 0x0F];
+ Destination_p[UsedDestLength] = '\0';
+ }
+ UsedDestLength++;
+
+ /* Insert the separator */
+ if (UsedDestLength < DestinationLength) {
+ size_t CopyLength;
+
+ CopyLength = MIN(SeparatorLength,
+ DestinationLength - UsedDestLength);
+ memcpy(Destination_p + UsedDestLength - 1, Separator_p,
+ CopyLength);
+ Destination_p[UsedDestLength - 1 + CopyLength] = '\0';
+ }
+ UsedDestLength += SeparatorLength;
+ }
+ return UsedDestLength;
+}
+
+/*************************************************************************
+* 6. Definition of internal functions
+*************************************************************************/
diff --git a/host/xtest/adbg/src/security_utils_hex.h b/host/xtest/adbg/src/security_utils_hex.h
new file mode 100644
index 0000000..b5847af
--- /dev/null
+++ b/host/xtest/adbg/src/security_utils_hex.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef INCLUSION_GUARD_UTILS_HEX_H
+#define INCLUSION_GUARD_UTILS_HEX_H
+/*************************************************************************
+* 1. Includes
+*************************************************************************/
+
+/*************************************************************************
+* 2. Types, constants and external variables
+*************************************************************************/
+
+#if 0 /* Should format into a buffer instead */
+/**
+ **************************************************************************
+ * Prints data hexadecimally to stdout
+ *
+ * Each line of binary data is printed as 66 characters on the format
+ * shown below:
+ * XX:XX:XX:XX XX:XX:XX:XX XX:XX:XX:XX XX:XX:XX:XX xxxxxxxxxxxxxxxx
+ *
+ * @param [in] Prefix_p String printed first each line, may be NULL
+ * to indicate the empty string
+ * @param [in] Postfix_p String printed last each line, may be NULL
+ * to indicate the empty string
+ * @param [in] BufferName_p Name of the buffer, if != NULL the name of the
+ * buffer is printed together with the length of
+ * the buffer before the data is printed
+ * @param [in] Buffer_p Pointer to a buffer holding the data
+ * @param [in] BufferLength Length of the buffer above
+ *
+ * @sigbased No
+ * @waitmode Wait mode
+ **************************************************************************/
+void SecUtil_HexPrintBuffer(const char *Prefix_p, const char *Postfix_p,
+ const char *BufferName_p, const void *Buffer_p,
+ size_t BufferLength);
+#endif
+
+#if 0
+/**
+ **************************************************************************
+ * Prints data hexadecimally in a format suitable for initialization of
+ * an array in c.
+ *
+ * 0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,
+ * 0xXX,0xXX,
+ *
+ * @param [in] Prefix_p String printed first each line, may be NULL
+ * to indicate the empty string
+ * @param [in] Postfix_p String printed last each line, may be NULL
+ * to indicate the empty string
+ * @param [in] Buffer_p Pointer to a buffer holding the data
+ * @param [in] BufferLength Length of the buffer above
+ *
+ * @sigbased No
+ * @waitmode Wait mode
+ **************************************************************************/
+void SecUtil_CHexPrintBuffer(const char *Prefix_p, const char *Postfix_p,
+ const void *Buffer_p, size_t BufferLength);
+#endif
+
+/**************************************************************************
+* Specifies how hexadecial data should be formated
+*
+* @param BytePrefix_p ASCII string prefix for each hexadecimal
+* byte printed (for example "0x"). If NULL
+* nothing is inserted in front of a byte.
+* @param ByteSeparator_p ASCII string to insert between each printed
+* hexadecimal byte. If NULL a ":" is inserted
+* between each hexadecial byte.
+* @param GroupSeparator_p ASCII string to insert instead of
+* ByteSeparator_p between each group
+* of printed hexadecimal bytes. If NULL " "
+* is used as group separator.
+**************************************************************************/
+typedef struct {
+ const char *BytePrefix_p;
+ const char *ByteSeparator_p;
+ const char *GroupSeparator_p;
+} SecUtil_HexFormat_t;
+
+/*************************************************************************
+* 3. Functions
+*************************************************************************/
+
+/****************************************************************************
+ * Formats data hexadecimally into an NULL terminated ASCII string in
+ * the format below.
+ *
+ * 0xXX:0xXX:0xXX:0xXX 0xXX:0xXX:0xXX:0xXX
+ * 0xXX:0xXX:0xXX:0xXX 0xXX:0xXX:0xXX:0xXX
+ *
+ * The colons and spaces in the result can be cusomized with ByteSeparator_p
+ * and GroupSeparator_p respectivly.
+ *
+ * @param [in] Buffer_p Pointer to a buffer holding the data
+ * @param [in] BufferLength Length of the buffer above
+ * @param [in] HexFormat_p How the data should be formatted
+ * @param [in, out] Destination_p Output ASCII buffer
+ * @param [in] DestinationLength Length of output buffer
+ *
+ * @returns The size of a needed DestinationLength, if greater than supplied
+ * DestinationLength the result in Destination_p is truncated but
+ * still NULL terminated.
+ * @sigbased No
+ * @waitmode Wait mode
+ **************************************************************************/
+
+size_t SecUtil_BufferToHex(const void *const Buffer_p, size_t BufferLength,
+ const SecUtil_HexFormat_t *const HexFormat_p,
+ char *const Destination_p,
+ const size_t DestinationLength);
+
+#endif /*INCLUSION_GUARD_UTILS_HEX_H*/
diff --git a/host/xtest/adbg/src/security_utils_mem.c b/host/xtest/adbg/src/security_utils_mem.c
new file mode 100644
index 0000000..f5b9acb
--- /dev/null
+++ b/host/xtest/adbg/src/security_utils_mem.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*************************************************************************
+* 1. Includes
+*************************************************************************/
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include "security_utils_mem.h"
+
+/*************************************************************************
+* 2. Definition of external constants and variables
+*************************************************************************/
+
+/*************************************************************************
+* 3. File scope types, constants and variables
+*************************************************************************/
+
+/*************************************************************************
+* 4. Declaration of file local functions
+*************************************************************************/
+
+static uint32_t MWC_Random(void *Pointer_p);
+
+/*************************************************************************
+* 5. Definition of external functions
+*************************************************************************/
+char *SecUtil_Heap_StrDup(
+ const char *const String_p,
+ const bool Unsafe,
+ const char *const File_p,
+ const unsigned int Line
+ )
+{
+ (void)&Unsafe;
+ (void)&File_p;
+ (void)&Line;
+ return strdup(String_p);
+}
+
+void SecUtil_WipeMemory(
+ void *const Buffer_p,
+ const size_t BufferLength
+ )
+{
+ uint8_t *p = Buffer_p;
+ size_t n;
+ uint32_t Number;
+
+ for (n = 0; n < BufferLength; n++)
+ p[n] = (uint8_t)n;
+
+ memset(p, 0xAA, BufferLength);
+ memset(p, 0x55, BufferLength);
+
+ for (n = 0; n < BufferLength / sizeof(uint32_t); n++) {
+ Number = MWC_Random(Buffer_p);
+ memcpy(p + n, &Number, sizeof(uint32_t));
+ }
+
+ n = (n - 1) * sizeof(uint32_t);
+
+/* Add the last bytes which didn't fill a complete uint32_t */
+ Number = MWC_Random(Buffer_p);
+ for (; n < BufferLength; n++) {
+ p[n] = 0xF & (uint8_t)Number;
+ Number >>= 8;
+ }
+}
+
+void SecUtil_SecureHeapFree_helper(
+ void **const Buffer_pp
+ )
+{
+ if (Buffer_pp != NULL) {
+ if (*Buffer_pp != NULL) {
+ free(*Buffer_pp);
+ *Buffer_pp = NULL;
+ }
+ }
+}
+
+/*************************************************************************
+* 6. Definition of internal functions
+*************************************************************************/
+
+/*
+ * There may be concurrent calls to this function but it doesn't matter,
+ * the result will still be hard to predict.
+ *
+ * Inspiration for implementation of this function was collected from
+ * http://www.bobwheeler.com/statistics/Password/MarsagliaPost.txt
+ * It doesn't seem to have any specified license, but in any case
+ * this a somewhat different implementation.
+ */
+static uint32_t MWC_Random(void *Pointer_p)
+{
+ static uint32_t static_z;
+ static uint32_t static_w;
+ static bool Initialized;
+/*
+ * In case of concurrent access, use private variables for
+ * the actual calculation.
+ */
+ uint32_t z = static_z;
+ uint32_t w = static_w;
+
+ if (!Initialized) {
+ z = 362436069 * ((uint32_t)(uintptr_t)Pointer_p >> 16);
+ w = 521288629 * ((uint32_t)(uintptr_t)Pointer_p & 0xFFFF);
+ Initialized = true;
+ }
+
+ z = 36969 * (z & 65535) + (z >> 16);
+ w = 18000 * (w & 65535) + (w >> 16);
+
+ static_z = z;
+ static_w = w;
+
+ return (z << 16) + (w & 65535);
+}
diff --git a/host/xtest/adbg/src/security_utils_mem.h b/host/xtest/adbg/src/security_utils_mem.h
new file mode 100644
index 0000000..831710f
--- /dev/null
+++ b/host/xtest/adbg/src/security_utils_mem.h
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef INCLUSION_GUARD_SECURITY_UTILS_MEM_H
+#define INCLUSION_GUARD_SECURITY_UTILS_MEM_H
+
+/*************************************************************************
+* 1. Includes
+*************************************************************************/
+
+#include <stdbool.h>
+/*************************************************************************
+* 2. Types, constants and external variables
+*************************************************************************/
+
+/*************************************************************************
+* 3. Functions and macros
+*************************************************************************/
+
+/**
+ * Creates an allocated copy if a string while keeping track of
+ * where the memory allocation was initiated.
+ *
+ * The copy should later be freed with HEAP_FREE
+ *
+ * @param in String_p The string to be copied
+ *
+ * @return Returns a pointer to a copy of String_p on success and NULL
+ * if memory allocation failed.
+ */
+#define SECUTIL_HEAP_STRDUP(String_p) \
+ SecUtil_Heap_StrDup((String_p), false, __FILE__, __LINE__)
+
+/**
+ * Creates an allocated copy if a string while keeping track of
+ * where the memory allocation was initiated.
+ *
+ * The copy should later be freed with HEAP_UNSAFE_FREE
+ *
+ * @param in String_p The string to be copied
+ *
+ * @return Returns a pointer to a copy of String_p on success and NULL
+ * if memory allocation failed.
+ */
+#define SECUTIL_HEAP_UNSAFE_STRDUP(String_p) \
+ SecUtil_Heap_StrDup((String_p), true, __FILE__, __LINE__)
+
+/**
+ * This function is a helper function for the two macros
+ * SECUTIL_HEAP_STRDUP and SECUTIL_HEAP_UNSAFE_STRDUP.
+ *
+ * The function allocates sufficient memroy for
+ * a copy of the string String_p.
+ *
+ * @param in String_p The string to be copied
+ * @param in Unsafe If true use HEAP_UNSAFE_UNTYPED_ALLOC_DBG else
+ * use HEAP_UNTYPED_ALLOC_DBG
+ * @param in File_p Name of the file where the function is called
+ * @param in Line Line number of the file where the function is called
+ *
+ * @return Returns a pointer to a copy of String_p on success and NULL
+ * if memory allocation failed.
+ */
+char *SecUtil_Heap_StrDup(const char *const String_p, const bool Unsafe,
+ const char *const File_p, const unsigned int Line);
+
+/**
+ * Wipes the buffer using several different bit patterns to avoid
+ * leaking information.
+ *
+ * This function should preferably be used as a help function in
+ * a FREE macro.
+ *
+ * @param in Buffer_p Pointer to the buffer to wipe
+ * @param in BufferLength Length (in bytes) of the buffer to wipe
+ */
+void SecUtil_WipeMemory(void *const Buffer_p, const size_t BufferLength);
+
+
+/*
+ * Modules using the SECURE_HEAP macros below should use them through
+ * a private define. This makes it easier during code inspection to see
+ * that the policy for handling memory is consistent.
+ */
+
+/**
+ * Macro for secure memory allocation. Only a wrapper for
+ * HEAP_ALLOC. The interesting part is SECUTIL_SECURE_HEAP_FREE
+ * below.
+ *
+ * @param in Type The type that memory should be allocated for
+ *
+ * @return a pointer to a buffer large enough to hald the supplied type,
+ * or NULL on failure.
+ */
+#define SECUTIL_SECURE_HEAP_ALLOC(Type) HEAP_ALLOC((TypeNmae))
+
+/**
+ * Macro for secure memory allocation. Only a wrapper for
+ * HEAP_UNTYPED_ALLOC. The interesting part is SECUTIL_SECURE_HEAP_FREE
+ * below.
+ *
+ * @param in Size The size of the buffer to be allocated
+ *
+ * @return a pointer to a buffer of the specified size,
+ * or NULL on failure.
+ */
+#define SECUTIL_SECURE_UNTYPED_HEAP_ALLOC(Size) \
+ HEAP_UNTYPED_ALLOC((Size))
+
+/**
+ * Macro for secure memory free. Secure is in the sense that information
+ * leakage is avoided by wiping the memory before it's released.
+ *
+ * Note that buffer must have been allocated with SECUTIL_SECURE_HEAP_ALLOC
+ * or SECUTIL_SECURE_UNTYPED_HEAP_ALLOC before of anything could happen
+ * (most likely a crash).
+ *
+ * @param in Buffer_pp A pointer to a pointer of the buffer to free.
+ */
+#define SECUTIL_SECURE_HEAP_FREE(Buffer_pp) \
+ SecUtil_SecureHeapFree_helper((void **)(Buffer_pp))
+
+
+/**
+ * Helper function for SECUTIL_SECURE_HEAP_FREE. The function
+ * calls HEAP_BUFFER_SIZE to determine the size of the buffer
+ * and then calls SecUtil_WipeMemory to wipe the memory. Finally
+ * the buffer is freed with HEAP_FREE
+ *
+ * If the supplied buffer is NULL this function does nothing.
+ *
+ * Note that the buffer has be allocated with HEAP_ALLOC or
+ * HEAP_UNTYPED_HEAP_ALLOC before or anything could happen.
+ *
+ * @param in Buffer_pp A pointer to a pointer of the buffer to
+ * wipe and free
+ */
+void SecUtil_SecureHeapFree_helper(void **const Buffer_pp);
+
+/**
+ * Macro for unaligned memcpy(). To be used when source or destination
+ * may not be properly aligned. Usage of this macro will only affect
+ * performance when copying large chunks of data (which is already
+ * present in the memory cache).
+ *
+ * Use this macro if you cannot guarantee that the pointers
+ * have properly aligned values.
+ */
+#define SEC_MEMCPY_UNALIGNED(x, y, z) \
+ do { \
+ void *memcpy_hack_dst = (x); \
+ const void *memcpy_hack_src = (y); \
+ memcpy(memcpy_hack_dst, memcpy_hack_src, (z)); \
+ } while (0)
+
+/**
+ * Macros for secure erase.
+ */
+#define SECUTIL_SECURE_ERASE_UINT32(X) { \
+ *((volatile uint32*)(&X)) = 0 }
+
+#define SECUTIL_SECURE_ERASE_UINT16(X) { \
+ *((volatile uint16*)(&X)) = 0 }
+
+#define SECUTIL_SECURE_ERASE_UINT8(X) { \
+ *((volatile uint8*)(&X)) = 0 }
+
+#define SECUTIL_SECURE_ERASE_BOOLEAN(X) { \
+ *((volatile bool*)(&X)) = 0 }
+
+#define SECUTIL_SECURE_ERASE_ARRAY(X) { \
+ memset(((void *)(X)), 0x0, sizeof(X)) }
+
+#define SECUTIL_SECURE_ERASE_TYPED_ARRAY(X) { \
+ SECUTIL_SECURE_ERASE_UNTYPED_ARRAY(X, sizeof(X)) }
+
+#define SECUTIL_SECURE_ERASE_UNTYPED_ARRAY(X, L) { \
+ memset(((void *)(X)), 0x0, L) }
+
+#define SECUTIL_SECURE_ERASE_STRUCT(X) { \
+ memset(((void *)(&X)), 0x0, sizeof(X)) }
+
+#endif /* INCLUSION_GUARD_SECURITY_UTILS_MEM_H */
diff --git a/host/xtest/adbg/src/t_list.h b/host/xtest/adbg/src/t_list.h
new file mode 100644
index 0000000..0a64f83
--- /dev/null
+++ b/host/xtest/adbg/src/t_list.h
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef INCLUSION_GUARD_T_LIST_H
+#define INCLUSION_GUARD_T_LIST_H
+
+/*************************************************************************
+**************************************************************************
+*
+* DESCRIPTION:
+*
+* Header file containing external type declaration for the doubly linked
+* list category "list"
+*
+*************************************************************************/
+
+#include <stddef.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#define List_t DL_List_t
+
+/**
+ * The client using the Util_ListDelete() and Util_ListDestroy()
+ * functions can provide a function that knows how to delete the client's
+ * elements. This is to simplify the client's code when destroying the list.
+ */
+typedef void (*ListDeleteFunction_t)(void *);
+
+/**
+ * Compare with ListDeleteFunction_t. Key and value is handled separately in
+ * general map style.
+ *
+ * @param [in, out] Key_p A pointer to the elements key for the element to be removed.
+ * @param [in, out] Value_p A pointer to the elements body for the element to be removed.
+ * @return void
+ */
+
+typedef void (*ListDeleteFunctionGeneralMap_t)(void *Key_p, void *Value_p);
+
+/**
+ * Compare with ListDeleteFunctionGeneralMap_t. Extra parameter for client handle
+ * used for ClientHandle style callbacks
+ *
+ * @param [in] ClientHandle_p A pointer to client handle.
+ * @param [in, out] Key_p A pointer to the element's key for the element to be removed.
+ * @param [in, out] Value_p A pointer to the element's body for the element to be removed.
+ * @return void
+ */
+typedef void (*ListDeleteFunctionGeneralMapClientHandleStyle_t)(const void *
+ const
+ ClientHandle_p,
+ void *Key_p,
+void *Value_p);
+
+/**
+ * This is a help function provided by the client. The function should
+ * print information about the client's elements. The function is used
+ * when printing the content of a list using Util_ListPrintDebug().
+ * The list library function prints information about the list while
+ * the client's function prints information about the elements that
+ * are in the list. One special version exist for General Map callback.
+ */
+
+typedef void (*ListDebugFunction_t)(void *);
+
+/**
+ * Compare with ListDebugFunction_t, this function type is harmonized with the
+ * style used in general Map. The ListDebugFunctionGeneralMap_t function
+ * is applied to each element when scanning through the entire List.
+ *
+ * @param [in] Key_p A pointer to the element's key for the current element
+ * (i.e. the element currently being iterated)
+ * @param [in, out] Value_p A pointer to the element's body for the current element
+ * (i.e. the element currently being iterated)
+ * @param [in, out] Data_pp A pointer to client's data (may also be used as output data)
+ * @param [in, out] Break_p TRUE if the client wants to break the iteration loop. FALSE
+ * otherwise.
+ *
+ *
+ */
+
+typedef void (*ListDebugFunctionGeneralMap_t)(const void *const Key_p,
+ void *const Value_p,
+ void **const Data_pp,
+ bool *const Break_p);
+
+/**
+ * This is a key comparison function provided by the client.
+ * When adding an element into a list, the client may provide a key.
+ * The key may then be used to find the element in the list.
+ * When the data type of the key is other than an integer
+ * (when Util_EListMatchingKey() is used) or an ascii string
+ * (when Util_ListMatchingKey() is used), the client has to provide a
+ * ListKeyMatchingFunction_t function that is called when comparing keys.
+ */
+
+typedef bool (*ListKeyMatchingFunction_t)(const void *, const void *);
+
+/**
+ * Compare with ListKeyMatchingFunction_t, only added an extra parameter for client handle
+ * used for ClientHandle style callbacks
+ *
+ * @param [in] ClientHandle_p A pointer to client handle.
+ * @param [in] KeyA_p A pointer to the first key. Must not be NULL.
+ * @param [in] KeyB_p A pointer to the second key. Must not be NULL.
+ * @return bool TRUE if the first and second key are identical.
+ * FALSE otherwise
+ */
+typedef bool (*ListKeyMatchingFunctionClientHandleStyle_t)(const void *
+ ClientHandle_p,
+ const void *KeyA_p,
+ const void *KeyB_p);
+
+/**
+ * This is a memory allocation function provided by the client.
+ * The client using Util_EListCreate() provides a memory allocation function.
+ * This may be useful in cases where a list is created in one context
+ * and freed in another context. Note that this usage (e.g. a list being
+ * used to share information between two or more processes) is strongly
+ * discouraged. Use Util_ListCreate() instead
+ */
+
+typedef void * (*ListMemAllocFunction_t)(size_t);
+
+/**
+ * This is a memory de-allocation function provided by the client.
+ * The client using Util_EListCreate() provides a memory allocation
+ * and de-allocation functions. This may be useful in cases where a
+ * list is created in one context and freed in another context.
+ * Note that this usage (e.g. a list being used to share information
+ * between two or more processes) is strongly discouraged.
+ * Use Util_ListCreate() instead.
+ */
+
+typedef void (*ListMemFreeFunction_t)(void *);
+
+
+/**
+ * Type used to link element in the list. LListItem is not publicized.
+ */
+
+typedef struct LListItem ListItem_t;
+
+/**
+ * Type used to hold a linked list. A pointer to a list is returned
+ * to the client after a call to Util_ListCreate(). Then, the list
+ * pointer is used as input to the other functions in the category.
+ * DL_List is not publicized.
+ */
+
+typedef struct DL_List DL_List_t;
+
+/**
+ * Completion code returned by some of the linked list library functions.
+ * The constant names are self explanatory.
+ */
+
+enum {
+ LIST_SUCCESS = 0,
+ LIST_ERROR_COULD_NOT_ALLOC_MEM,
+ LIST_ERROR_INVALID_LIST,
+ LIST_ERROR_INVALID_PARAM,
+ LIST_ERROR_CURRENT_PTR_OFF_LIST,
+ LIST_ERROR_NO_MATCH_FOUND,
+ LIST_ERROR_UNKNOWN
+};
+typedef uint8_t ListResult_t;
+
+
+/**
+ * The list status indicates whether conditions of interest
+ *
+ * \li a) whether the list is empty
+ * \li b) whether the current pointer points to the head
+ * \li c) whether the current pointer points to the tail
+ * \li d) whether the current pointer does not point inside the list
+ * \li e) whether the list is valid (ie. list pointer is not NULL)
+ *
+ * Note: b) and c) can be true at the same time.
+ *
+ */
+
+enum {
+ LIST_STATUS_NOTHING_TO_REPORT = 0x00,
+ LIST_STATUS_PTR_TO_TAIL = 0x01, /* to be used as bit mask */
+ LIST_STATUS_PTR_TO_HEAD = 0x02, /* to be used as bit mask */
+ LIST_STATUS_PTR_OFF_LIST = 0x04, /* 2 LSB must be 0 */
+ LIST_STATUS_LIST_EMPTY = 0x08, /* 2 LSB must be 0 */
+ LIST_STATUS_INVALID_LIST = 0x80
+};
+typedef uint8_t ListStatus_t;
+
+#endif /* INCLUSION_GUARD_T_LIST_H */
diff --git a/host/xtest/adbg_case_declare.h b/host/xtest/adbg_case_declare.h
new file mode 100644
index 0000000..7a76393
--- /dev/null
+++ b/host/xtest/adbg_case_declare.h
@@ -0,0 +1,734 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef ADBG_CASE_DECLARE_H
+#define ADBG_CASE_DECLARE_H
+
+#define ADBG_CASE_DECLARE_AUTO_GENERATED_TESTS() \
+ ADBG_CASE_DECLARE(XTEST_TEE_7001);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7002);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7003);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7004);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7005);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7006);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7007);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7008);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7009);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7010);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7011);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7012);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7013);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7014);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7015);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7016);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7017);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7018);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7019);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7020);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7021);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7022);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7023);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7024);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7025);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7026);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7027);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7028);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7029);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7030);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7031);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7032);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7033);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7034);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7035);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7036);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7037);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7038);\
+ \
+ ADBG_CASE_DECLARE(XTEST_TEE_7501);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7502);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7503);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7504);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7505);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7506);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7507);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7508);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7509);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7510);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7511);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7512);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7513);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7514);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7515);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7516);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7517);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7518);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7519);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7520);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7521);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7522);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7523);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7524);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7525);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7526);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7527);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7528);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7529);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7530);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7531);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7532);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7533);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7534);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7535);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7536);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7537);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7538);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7539);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7540);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7541);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7542);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7543);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7544);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7545);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7546);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7547);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7548);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7549);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7550);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7551);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7552);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7553);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7554);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7555);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7556);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7557);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7558);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7559);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7560);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7561);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7562);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7563);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7564);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7565);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7566);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7567);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7568);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7569);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7570);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7571);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7572);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7573);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7574);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7575);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7576);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7577);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7578);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7579);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7580);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7581);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7582);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7583);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7584);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7585);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7586);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7587);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7588);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7589);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7590);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7591);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7592);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7593);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7594);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7595);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7596);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7597);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7598);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7599);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7600);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7601);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7602);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7603);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7604);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7605);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7606);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7607);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7608);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7609);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7610);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7611);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7612);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7613);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7614);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7615);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7616);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7617);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7618);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7619);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7620);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7621);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7622);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7623);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7624);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7625);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7626);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7627);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7628);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7629);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7630);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7631);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7632);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7633);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7634);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7635);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7636);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7637);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7638);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7639);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7640);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7641);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7642);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7643);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7644);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7645);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7646);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7647);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7648);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7649);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7650);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7651);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7652);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7653);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7654);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7655);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7656);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7657);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7658);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7659);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7660);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7661);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7662);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7663);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7664);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7665);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7666);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7667);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7668);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7669);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7670);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7671);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7672);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7673);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7674);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7675);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7676);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7677);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7678);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7679);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7680);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7681);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7682);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7683);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7684);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7685);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7686);\
+ ADBG_CASE_DECLARE(XTEST_TEE_7687);\
+ \
+ ADBG_CASE_DECLARE(XTEST_TEE_8001);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8002);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8003);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8004);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8005);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8006);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8007);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8008);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8009);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8010);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8011);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8012);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8013);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8014);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8015);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8016);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8017);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8018);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8019);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8020);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8021);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8022);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8023);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8024);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8025);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8026);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8027);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8028);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8029);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8030);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8031);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8032);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8033);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8034);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8035);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8036);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8037);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8038);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8039);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8040);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8041);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8042);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8043);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8044);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8045);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8046);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8047);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8048);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8049);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8050);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8051);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8052);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8053);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8054);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8055);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8056);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8057);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8058);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8059);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8060);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8061);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8062);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8063);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8064);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8065);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8066);\
+ \
+ ADBG_CASE_DECLARE(XTEST_TEE_8501);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8502);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8503);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8504);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8505);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8506);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8507);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8508);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8509);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8510);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8511);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8512);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8513);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8514);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8515);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8516);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8517);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8518);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8519);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8520);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8521);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8522);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8523);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8524);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8525);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8526);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8527);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8528);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8529);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8530);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8531);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8532);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8533);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8534);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8535);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8536);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8537);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8538);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8539);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8540);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8541);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8542);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8543);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8544);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8545);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8546);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8547);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8548);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8549);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8550);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8551);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8552);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8553);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8554);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8555);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8556);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8557);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8558);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8559);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8560);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8561);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8562);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8563);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8564);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8565);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8566);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8567);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8568);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8569);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8570);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8571);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8572);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8573);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8574);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8575);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8576);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8577);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8578);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8579);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8580);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8581);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8582);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8583);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8584);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8585);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8586);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8587);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8588);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8589);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8590);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8591);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8592);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8593);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8594);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8595);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8596);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8597);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8598);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8599);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8600);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8601);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8602);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8603);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8604);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8605);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8606);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8607);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8608);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8609);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8610);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8611);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8612);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8613);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8614);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8615);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8616);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8617);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8618);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8619);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8620);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8621);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8622);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8623);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8624);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8625);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8626);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8627);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8628);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8629);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8630);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8631);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8632);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8633);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8634);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8635);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8636);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8637);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8638);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8639);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8640);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8641);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8642);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8643);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8644);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8645);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8646);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8647);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8648);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8649);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8650);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8651);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8652);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8653);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8654);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8655);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8656);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8657);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8658);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8659);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8660);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8661);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8662);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8663);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8664);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8665);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8666);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8667);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8668);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8669);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8670);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8671);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8672);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8673);\
+ ADBG_CASE_DECLARE(XTEST_TEE_8674);\
+ \
+ ADBG_CASE_DECLARE(XTEST_TEE_9001);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9002);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9003);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9004);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9005);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9006);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9007);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9008);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9009);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9010);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9011);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9012);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9013);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9014);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9015);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9016);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9017);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9018);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9019);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9020);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9021);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9022);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9023);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9024);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9025);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9026);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9027);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9028);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9029);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9030);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9031);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9032);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9033);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9034);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9035);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9036);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9037);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9038);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9039);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9040);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9041);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9042);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9043);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9044);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9045);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9046);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9047);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9048);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9049);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9050);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9051);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9052);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9053);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9054);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9055);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9056);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9057);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9058);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9059);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9060);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9061);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9062);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9063);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9064);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9065);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9066);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9067);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9068);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9069);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9070);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9071);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9072);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9073);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9074);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9075);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9076);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9077);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9078);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9079);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9080);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9081);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9082);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9083);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9084);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9085);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9086);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9087);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9088);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9089);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9090);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9091);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9092);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9093);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9094);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9095);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9096);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9097);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9098);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9099);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9100);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9101);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9102);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9103);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9104);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9105);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9106);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9107);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9108);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9109);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9110);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9111);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9112);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9113);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9114);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9115);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9116);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9117);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9118);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9119);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9120);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9121);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9122);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9123);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9124);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9125);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9126);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9127);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9128);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9129);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9130);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9131);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9132);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9133);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9134);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9135);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9136);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9137);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9138);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9139);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9140);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9141);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9142);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9143);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9144);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9145);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9146);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9147);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9148);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9149);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9150);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9151);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9152);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9153);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9154);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9155);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9156);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9157);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9158);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9159);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9160);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9161);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9162);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9163);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9164);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9165);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9166);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9167);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9168);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9169);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9170);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9171);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9172);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9173);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9174);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9175);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9176);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9177);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9178);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9179);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9180);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9181);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9182);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9183);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9184);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9185);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9186);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9187);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9188);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9189);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9190);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9191);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9192);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9193);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9194);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9195);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9196);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9197);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9198);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9199);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9200);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9201);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9202);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9203);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9204);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9205);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9206);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9207);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9208);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9209);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9210);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9211);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9212);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9213);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9214);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9215);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9216);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9217);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9218);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9219);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9220);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9221);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9222);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9223);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9224);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9225);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9226);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9227);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9228);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9229);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9230);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9231);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9232);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9233);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9234);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9235);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9236);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9237);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9238);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9239);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9240);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9241);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9242);\
+ ADBG_CASE_DECLARE(XTEST_TEE_9243);\
+
+/* end of case declarations */
+
+
+#endif /*ADBG_CASE_DECLARE_H*/
diff --git a/host/xtest/adbg_entry_declare.h b/host/xtest/adbg_entry_declare.h
new file mode 100644
index 0000000..14892c1
--- /dev/null
+++ b/host/xtest/adbg_entry_declare.h
@@ -0,0 +1,733 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef ADBG_ENTRY_DECLARE_H
+#define ADBG_ENTRY_DECLARE_H
+
+#define ADBG_ENTRY_AUTO_GENERATED_TESTS() \
+ ADBG_SUITE_ENTRY(XTEST_TEE_7001, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7002, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7003, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7004, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7005, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7006, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7007, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7008, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7009, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7010, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7011, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7012, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7013, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7014, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7015, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7016, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7017, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7018, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7019, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7020, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7021, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7022, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7023, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7024, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7025, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7026, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7027, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7028, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7029, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7030, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7031, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7032, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7033, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7034, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7035, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7036, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7037, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7038, NULL)*/\
+ \
+ ADBG_SUITE_ENTRY(XTEST_TEE_7501, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7502, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7503, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7504, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7505, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7506, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7507, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7508, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7509, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7510, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7511, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7512, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7513, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7514, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7515, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7516, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7517, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7518, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7519, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7520, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7521, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7522, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7523, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7524, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7525, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7526, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7527, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7528, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7529, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7530, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7531, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7532, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7533, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7534, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7535, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7536, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7537, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7538, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7539, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7540, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7541, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7542, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7543, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7544, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7545, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7546, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7547, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7548, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7549, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7550, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7551, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7552, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7553, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7554, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7555, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7556, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7557, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7558, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7559, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7560, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7561, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7562, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7563, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7564, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7565, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7566, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7567, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7568, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7569, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7570, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7571, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7572, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7573, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7574, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7575, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7576, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7577, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7578, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7579, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7580, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7581, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7582, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7583, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7584, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7585, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7586, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7587, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7588, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7589, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7590, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7591, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7592, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7593, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7594, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7595, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7596, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7597, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7598, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7599, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7600, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7601, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7602, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7603, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7604, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7605, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7606, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7607, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7608, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7609, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7610, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7611, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7612, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7613, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7614, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7615, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7616, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7617, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7618, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7619, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7620, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7621, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7622, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7623, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7624, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7625, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7626, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7627, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7628, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7629, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7630, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7631, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7632, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7633, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7634, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7635, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7636, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7637, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7638, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7639, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7640, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7641, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7642, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7643, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7644, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7645, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7646, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7647, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7648, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7649, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7650, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7651, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7652, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7653, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7654, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7655, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7656, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7657, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7658, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7659, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7660, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7661, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7662, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7663, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7664, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7665, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7666, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7667, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7668, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7669, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7670, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7671, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7672, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7673, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7674, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7675, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7676, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7677, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7678, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7679, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7680, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7681, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7682, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7683, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7684, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7685, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_7686, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_7687, NULL)\
+ \
+ ADBG_SUITE_ENTRY(XTEST_TEE_8001, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8002, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8003, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8004, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8005, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8006, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8007, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8008, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8009, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8010, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8011, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8012, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8013, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8014, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8015, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8016, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8017, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8018, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8019, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8020, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8021, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8022, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8023, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8024, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_8025, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8026, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8027, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8028, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8029, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_8030, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8031, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8032, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8033, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8034, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8035, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8036, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8037, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8038, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8039, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8040, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8041, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8042, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8043, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8044, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8045, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8046, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8047, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8048, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8049, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8050, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8051, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8052, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8053, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8054, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8055, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8056, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8057, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8058, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8059, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8060, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8061, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8062, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8063, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8064, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8065, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_8066, NULL)*/\
+ \
+ ADBG_SUITE_ENTRY(XTEST_TEE_8501, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8502, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8503, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8504, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8505, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8506, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8507, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8508, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8509, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8510, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8511, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8512, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8513, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8514, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8515, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8516, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8517, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8518, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8519, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8520, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8521, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8522, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8523, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8524, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8525, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8526, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8527, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8528, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8529, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8530, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8531, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8532, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8533, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8534, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8535, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8536, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8537, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8538, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8539, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8540, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8541, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8542, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8543, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8544, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8545, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8546, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8547, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8548, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8549, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8550, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8551, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8552, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8553, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8554, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8555, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8556, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8557, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8558, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8559, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8560, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8561, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8562, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8563, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8564, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8565, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8566, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8567, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8568, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8569, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8570, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8571, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8572, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8573, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8574, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8575, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8576, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8577, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8578, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8579, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8580, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8581, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8582, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8583, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8584, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8585, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8586, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8587, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8588, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8589, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8590, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8591, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8592, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8593, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8594, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8595, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8596, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8597, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8598, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8599, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8600, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8601, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8602, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8603, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8604, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8605, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8606, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8607, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8608, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8609, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8610, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8611, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8612, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8613, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_8614, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8615, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8616, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8617, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8618, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8619, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8620, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8621, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8622, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8623, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8624, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8625, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8626, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8627, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8628, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8629, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8630, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8631, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8632, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8633, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8634, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8635, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8636, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8637, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8638, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8639, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8640, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8641, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8642, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_8643, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_8644, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8645, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8646, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8647, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8648, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8649, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8650, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8651, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8652, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8653, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8654, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8655, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8656, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8657, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8658, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8659, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8660, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8661, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8662, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8663, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8664, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8665, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8666, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8667, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8668, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8669, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8670, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8671, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_8672, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_8673, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_8674, NULL)*/\
+ \
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9001, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9002, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9003, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9004, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9005, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9006, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9007, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9008, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9009, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9010, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9011, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9012, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9013, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9014, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9015, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9016, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9017, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9018, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9019, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9020, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9021, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9022, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9023, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9024, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9025, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9026, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9027, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9028, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9029, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9030, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9031, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9032, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9033, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9034, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9035, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9036, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9037, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9038, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9039, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9040, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9041, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9042, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9043, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9044, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9045, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9046, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9047, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9048, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9049, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9050, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9051, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9052, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9053, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9054, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9055, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9056, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9057, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9058, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9059, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9060, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9061, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9062, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9063, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9064, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9065, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9066, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9067, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9068, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9069, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9070, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9071, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9072, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9073, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9074, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9075, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9076, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9077, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9078, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9079, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9080, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9081, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9082, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9083, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9084, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9085, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9086, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9087, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9088, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9089, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9090, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9091, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9092, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9093, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9094, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9095, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9096, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9097, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9098, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9099, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9100, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9101, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9102, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9103, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9104, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9105, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9106, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9107, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9108, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9109, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9110, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9111, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9112, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9113, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9114, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9115, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9116, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9117, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9118, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9119, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9120, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9121, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9122, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9123, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9124, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9125, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9126, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9127, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9128, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9129, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9130, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9131, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9132, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9133, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9134, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9135, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9136, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9137, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9138, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9139, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9140, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9141, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9142, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9143, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9144, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9145, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9146, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9147, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9148, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9149, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9150, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9151, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9152, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9153, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9154, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9155, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9156, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9157, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9158, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9159, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9160, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9161, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9162, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9163, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9164, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9165, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9166, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9167, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9168, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9169, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9170, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9171, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9172, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9173, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9174, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9175, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9176, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9177, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9178, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9179, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9180, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9181, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9182, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9183, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9184, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9185, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9186, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9187, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9188, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9189, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9190, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9191, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9192, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9193, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9194, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9195, NULL)*/\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9196, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9197, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9198, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9199, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9200, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9201, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9202, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9203, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9204, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9205, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9206, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9207, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9208, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9209, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9210, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9211, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9212, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9213, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9214, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9215, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9216, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9217, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9218, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9219, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9220, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9221, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9222, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9223, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9224, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9225, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9226, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9227, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9228, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9229, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9230, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9231, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9232, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9233, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9234, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9235, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9236, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9237, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9238, NULL)\
+ /*ADBG_SUITE_ENTRY(XTEST_TEE_9239, NULL)*/\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9240, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9241, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9242, NULL)\
+ ADBG_SUITE_ENTRY(XTEST_TEE_9243, NULL)\
+
+/* end of entry declarations */
+
+#endif /*ADBG_ENTRY_DECLARE_H*/
diff --git a/host/xtest/xml/include/xml_client_api.h b/host/xtest/xml/include/xml_client_api.h
new file mode 100644
index 0000000..b5edb97
--- /dev/null
+++ b/host/xtest/xml/include/xml_client_api.h
@@ -0,0 +1,372 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef XML_CLIENT_API_H_
+#define XML_CLIENT_API_H_
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include "tee_client_api.h"
+#ifdef USER_SPACE
+#include <pthread.h>
+#include <unistd.h>
+#endif
+
+#define CLIENT_APP01 NULL
+
+#define TEEC_UNDEFINED_ERROR 0xDEADDEAD
+
+#define TEEC_ORIGIN_ANY_NOT_TRUSTED_APP 0x00000005
+
+#define OFFSET0 0
+
+#ifdef USER_SPACE
+/*Test data defines*/
+static pthread_t THREAD02;
+#endif
+
+static TEEC_SharedMemory *SHARE_MEM01;
+static TEEC_SharedMemory *SHARE_MEM02;
+static TEEC_Session *SESSION01;
+static TEEC_Context *CONTEXT01;
+static TEEC_Operation *OPERATION01;
+static TEEC_Operation *OPERATION02;
+
+/* Return ORIGIN */
+static uint32_t ret_orig;
+
+static uint32_t BIG_SIZE = 1024;
+
+static uint32_t IGNORE = 0xFEFEFEFE;
+static uint32_t VALUE01 = 0x01234567;
+static uint32_t VALUE02 = 0xFEDCBA98;
+static uint32_t SIZE_OVER_MEMORY = 0xFFFFFFFE;
+static uint32_t SIZE_VALUE01 = sizeof(VALUE01);
+static uint32_t ZERO;
+
+#define INVALID_CONNECTION_METHODS 0x0A
+#define COMMAND_TTA_Check_Expected_ParamTypes COMMAND_TTA_Check_ParamTypes
+
+#define TEEC_MEM_INOUT 0x00000003
+
+/* "ItIsNotTotosTEEs" */
+const char *INVALID_NOT_EXISTING_TEE = "ItIsNotTotosTEEs\0";
+
+/** ALL_TEMPORARY_MEMORIES */
+uint8_t *TEMP_MEM01;
+uint8_t *TEMP_MEM02;
+
+/** ALL_TEEC_UUID
+ *
+ * These constants are the UUID of existing
+ * Trusted Applications
+ */
+/* "SMARTCSLTERRTOOS" */
+static TEEC_UUID UUID_TTA_answerErrorTo_OpenSession = {
+ 0x534D4152, 0x5443, 0x534C,
+ { 0x54, 0x45, 0x52, 0x52, 0x54, 0x4F, 0x4F, 0x53 }
+};
+/* "SMART-CSLT-TA-SU" */
+static TEEC_UUID UUID_TTA_answerSuccessTo_OpenSession_Invoke = {
+ 0x534D4152, 0x542D, 0x4353,
+ { 0x4C, 0x54, 0x2D, 0x54, 0x41, 0x2D, 0x53, 0x55 }
+};
+/* "SMARTCSLTOS4PARM" */
+static TEEC_UUID UUID_TTA_check_OpenSession_with_4_parameters = {
+ 0x534D4152, 0x5443, 0x534C,
+ { 0x54, 0x4F, 0x53, 0x34, 0x50, 0x41, 0x52, 0x4D }
+};
+/* "SMART-CUNK-NO-WN" */
+static TEEC_UUID UUID_Unknown = {
+ 0x534D4152, 0x542D, 0x4355,
+ { 0x4E, 0x4B, 0x2D, 0x4E, 0x4F, 0x2D, 0x57, 0x4E }
+};
+
+/*Helper functions/macros*/
+#define IDENTIFIER_NOT_USED(x) { if (sizeof(&x)) {} }
+
+/* XML_VERIFY macro define.
+ *
+ * Use ADBG_EXPECT or ADBG_EXPECT_NOT depending on the expected return value.
+ *
+ * ADBG_EXPECT() -> IF(EXP == GOT) RETURN TRUE
+ * ADBG_EXPECT() -> IF(EXP != GOT) RETURN TRUE
+ */
+#define XML_VERIFY(c, exp, got) \
+ do { \
+ if (exp == TEEC_UNDEFINED_ERROR) \
+ ADBG_EXPECT_NOT(c, exp, got); \
+ else \
+ ADBG_EXPECT(c, exp, got); \
+ } while (0)
+
+/*Initialize context using TEEC_InitializeContext and
+ check the returned value.*/
+#define XML_InitializeContext(c, name, context, expected) \
+ XML_VERIFY(c, expected, TEEC_InitializeContext(name, context))
+
+/*Open session using TEEC_OpenSession and
+ check the returned value and/or returned origin.*/
+#define XML_OpenSession(c, context, session, destination, connectionMethod, \
+ connectionData, operation, returnOrigin, expected) \
+ do { \
+ XML_VERIFY(c, expected, \
+ TEEC_OpenSession(context, session, destination, \
+ connectionMethod, connectionData, \
+ operation, &ret_orig)); \
+ if ((returnOrigin != 0) && \
+ (returnOrigin != TEEC_ORIGIN_ANY_NOT_TRUSTED_APP)) \
+ ADBG_EXPECT(c, returnOrigin, ret_orig); \
+ else \
+ ADBG_EXPECT_NOT(c, returnOrigin, ret_orig); \
+ } while (0)
+
+#define OPERATION_TEEC_PARAM_TYPES(op, p0, p1, p2, p3) \
+ op->paramTypes = TEEC_PARAM_TYPES(p0, p1, p2, p3)
+
+/*dummy functions*/
+#define TEEC_SelectApp(a, b) /*do nothing for now*/
+#define TEEC_createThread(a, b) /*do nothing for now*/
+
+/*Allocates TEEC_SharedMemory inside of the TEE*/
+static TEEC_Result AllocateSharedMemory(TEEC_Context *ctx,
+ TEEC_SharedMemory *shm,
+ uint32_t size, uint32_t flags)
+{
+ shm->flags = flags;
+ shm->size = size;
+ return TEEC_AllocateSharedMemory(ctx, shm);
+}
+
+/*Registers the TEEC_SharedMemory to the TEE*/
+static TEEC_Result RegisterSharedMemory(TEEC_Context *ctx,
+ TEEC_SharedMemory *shm,
+ uint32_t size, uint32_t flags)
+{
+ shm->flags = flags;
+ shm->size = size;
+ shm->buffer = malloc(size);
+ return TEEC_RegisterSharedMemory(ctx, shm);
+}
+
+/*Allocates temporary memory area*/
+#define AllocateTempMemory(temp_mem, size) \
+ temp_mem = malloc(size)
+
+/*Releases temporary memory area*/
+#define ReleaseTempMemory(temp_mem) \
+ do { \
+ if (temp_mem != NULL) { \
+ free(temp_mem); \
+ temp_mem = NULL; \
+ } \
+ } while (0)
+
+
+/* Assigns a and b to the value parameter */
+static void TEEC_prepare_OperationEachParameter_value(TEEC_Operation *op,
+ size_t n, uint32_t a,
+ uint32_t b)
+{
+ if (IGNORE != a)
+ op->params[n].value.a = a;
+
+ if (IGNORE != b)
+ op->params[n].value.b = b;
+
+}
+
+/*Define TEEC_SharedMemory memory content.*/
+#define TEEC_defineMemoryContent_sharedMemory(sh_mem, val, size_val) \
+ memcpy(sh_mem->buffer, &val, size_val)
+
+/*Define temp memory content.*/
+#define TEEC_defineMemoryContent_tmpMemory(buf, val, size_val) \
+ memcpy(buf, &(val), size_val)
+
+#define INVOKE_REMEMBER_EXP_PARAM_TYPES(session, cmd, p0, p1, p2, p3, exp) \
+ do { \
+ memset(OPERATION01, 0x00, sizeof(TEEC_Operation)); \
+ OPERATION01->paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, \
+ TEEC_NONE, \
+ TEEC_NONE, \
+ TEEC_NONE); \
+ OPERATION01->params[0].value.a = \
+ TEEC_PARAM_TYPES((p0), (p1), (p2), (p3)); \
+ ADBG_EXPECT(c, exp, \
+ TEEC_InvokeCommand(session, cmd, OPERATION01, \
+ &ret_orig)); \
+ ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP, \
+ ret_orig); \
+ } while (0)
+
+/*Compares two memories and checks if their length and content is the same */
+#define TEEC_checkMemoryContent_sharedMemory(op, param_num, shrm, exp_buf, \
+ exp_blen) \
+ do { \
+ if ((exp_buf) == IGNORE) { \
+ ADBG_EXPECT((c), exp_blen, \
+ (op)->params[(param_num)].memref.size); \
+ } else { \
+ ADBG_EXPECT_COMPARE_POINTER((c), (shrm), ==, \
+ (op)->params[(param_num)].\
+ memref.parent); \
+ ADBG_EXPECT_BUFFER((c), &(exp_buf), (exp_blen), \
+ (shrm)->buffer, \
+ (op)->params[(param_num)].\
+ memref.size); \
+ } \
+ } while (0)
+
+/*
+ * Compares the content of the memory cells in OP with the expected value
+ * contained.
+ */
+#define TEEC_checkMemoryContent_tmpMemory(op, param_num, \
+ buf, exp_buf, exp_blen) \
+ do { \
+ if ((exp_buf) == 0) { \
+ ADBG_EXPECT((c), exp_blen, \
+ (op)->params[(param_num)].tmpref.size); \
+ } else { \
+ ADBG_EXPECT_COMPARE_POINTER((c), (buf), ==, \
+ (op)->params[(param_num)].\
+ tmpref.buffer); \
+ ADBG_EXPECT_BUFFER((c), &(exp_buf), (exp_blen), \
+ (buf), \
+ (op)->params[(param_num)].\
+ memref.size); \
+ } \
+ } while (0)
+
+/*
+ * Compares the content of the memory cells in OP with the expected value
+ * contained.
+ */
+#define TEEC_checkContent_Parameter_value(op, param_num, exp_a, exp_b) \
+ do { \
+ if (IGNORE != exp_a) \
+ ADBG_EXPECT((c), exp_a, \
+ (op)->params[(param_num)].value.a); \
+ if (IGNORE != exp_b) \
+ ADBG_EXPECT((c), exp_b, \
+ (op)->params[(param_num)].value.b); \
+ } while (0)
+
+/*Invoke command using TEEC_InvokeCommand and check the returned value.*/
+#define XML_InvokeCommand(c, session, cmd, operation, returnOrigin, expected) \
+ do { \
+ ADBG_EXPECT(c, expected, \
+ TEEC_InvokeCommand(session, cmd, operation, \
+ &ret_orig)); \
+ if (returnOrigin != 0) \
+ ADBG_EXPECT(c, (int)returnOrigin, ret_orig); \
+ } while (0)
+
+#ifdef USER_SPACE
+#define RequestCancellation(op) \
+ (void)ADBG_EXPECT(c, 0, \
+ pthread_create(&THREAD02, NULL, cancellation_thread, \
+ (void *)op)); \
+ (void)ADBG_EXPECT(c, 0, pthread_join(THREAD02, NULL));
+#else
+#define RequestCancellation(op) \
+ IDENTIFIER_NOT_USED(op)
+#endif
+
+struct ctx_thr {
+ ADBG_Case_t *c;
+ TEEC_Context *ctx;
+};
+
+static struct ctx_thr thr2_ctx;
+
+#ifdef USER_SPACE
+static void *context_thread(void *arg)
+{
+ /*
+ * Sleep 0.5 seconds before cancellation to make sure that the other
+ * thread is in RPC_WAIT.
+ */
+ XML_InitializeContext(((struct ctx_thr *)arg)->c, _device,
+ ((struct ctx_thr *)arg)->ctx, TEEC_SUCCESS);
+ TEEC_FinalizeContext(((struct ctx_thr *)arg)->ctx);
+
+ return NULL;
+}
+#endif
+
+#ifdef USER_SPACE
+#define ctx_init_finalize(t_ctx) \
+ (void)ADBG_EXPECT(c, 0, \
+ pthread_create(&THREAD02, NULL, context_thread, \
+ (void *)&t_ctx)); \
+ (void)ADBG_EXPECT(c, 0, pthread_join(THREAD02, NULL));
+#else
+#define ctx_init_finalize(t_ctx) \
+ IDENTIFIER_NOT_USED(t_ctx)
+#endif
+
+#ifdef XTEST_WITH_GP_TESTS
+/*
+ * Required by Global Platform test suite for v1.0
+ */
+static uint32_t BIG_VALUE = 1024; /* BIG_SIZE */
+static uint32_t SIZE_LESSER_THAN_SIZE_VALUE01 = sizeof(VALUE01) - 1;
+
+/* "SMART-CSLT-TA-ER" */
+static TEEC_UUID UUID_TTA_answerErrorTo_Invoke = {
+ 0x534D4152, 0x542D, 0x4353,
+ { 0x4C, 0x54, 0x2D, 0x54, 0x41, 0x2D, 0x45, 0x52 }
+};
+
+/* "SMART-CSLT-TA-ST" */
+/* Used in GP Tests */
+static TEEC_UUID UUID_TTA_testingClientAPI = {
+ 0x534D4152, 0x542D, 0x4353,
+ { 0x4C, 0x54, 0x2D, 0x54, 0x41, 0x2D, 0x53, 0x54 }
+};
+
+#ifdef USER_SPACE
+static void *cancellation_thread(void *arg)
+{
+ TEEC_RequestCancellation((TEEC_Operation *)arg);
+ return NULL;
+}
+#endif
+
+/* Assigns parent, offset and size to the memref parameter */
+static void TEEC_prepare_OperationEachParameter_memref(TEEC_Operation *op,
+ size_t n,
+ TEEC_SharedMemory *parent, unsigned offset,
+ unsigned size)
+{
+ op->params[n].memref.parent = parent;
+ op->params[n].memref.offset = offset;
+ op->params[n].memref.size = size;
+}
+
+/* Assigns buffer and size to the tmpref parameter */
+static void TEEC_prepare_OperationEachParameter_tmpref(TEEC_Operation *op,
+ size_t n,
+ uint8_t *buffer,
+ unsigned size)
+{
+ op->params[n].tmpref.buffer = buffer;
+ op->params[n].tmpref.size = size;
+}
+#endif
+
+#endif /* XML_CLIENT_API_H_ */
diff --git a/host/xtest/xml/include/xml_crypto_api.h b/host/xtest/xml/include/xml_crypto_api.h
new file mode 100644
index 0000000..4ba95c6
--- /dev/null
+++ b/host/xtest/xml/include/xml_crypto_api.h
@@ -0,0 +1,2581 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef XML_CRYPTO_API_H_
+#define XML_CRYPTO_API_H_
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "tee_client_api.h"
+#include "utee_defines.h"
+#include "xtest_test.h"
+
+#define BIT_CHANGE(a, b) ((a) ^= (1 << (b)))
+
+#define CRYPTO_INIT(b) \
+ b.buffer = NULL; \
+ b.size = 0;
+
+#define CRYPTO_MALLOC(b, size) \
+ b.size = size; \
+ b.buffer = malloc(size);
+
+#define CRYPTO_FREE(b) { \
+ if (b.buffer != NULL) { \
+ b.size = 0; \
+ free(b.buffer); \
+ b.buffer = NULL; \
+ } }
+
+/*Crypto_CMD redefines*/
+#define CMD_AsymmetricVerifyDigest CMD_AsymmetricVerifyDigestNoParam
+#define CMD_AsymmetricSignDigest CMD_AsymmetricSignDigestNoParam
+#define CMD_AsymmetricEncrypt CMD_AsymmetricEncryptNoParam
+#define CMD_AsymmetricDecrypt CMD_AsymmetricDecryptNoParam
+
+/*Missing TEE Error codes*/
+#define TEE_ERROR_TOO_SHORT_BUFFER TEE_ERROR_SHORT_BUFFER
+
+/*Other defines*/
+#define TEE_USAGE_NONE 0
+
+#define BIG_SIZE 1024
+uint32_t DS_BIG_SIZE = 16384;
+
+/*ALL_OBJECT_SIZES*/
+#define KEY_SIZE_TOO_LARGE 4096
+#define SIZE_AES_256 256
+#define SIZE_DES3_192 168
+#define SIZE_DES_64 56
+#define SIZE_DH_KEYPAIR_1024 1024
+#define SIZE_DSA_KEYPAIR_768 768
+#define SIZE_DSA_PUBLIC_KEY_768 768
+#define SIZE_GENERIC_SECRET_2048 2048
+#define SIZE_HMAC_MD5_256 256
+#define SIZE_HMAC_SHA1_256 256
+#define SIZE_HMAC_SHA224_256 256
+#define SIZE_HMAC_SHA256_512 512
+#define SIZE_HMAC_SHA384_512 512
+#define SIZE_HMAC_SHA512_512 512
+#define SIZE_RSA_KEYPAIR_2048 2048
+#define SIZE_RSA_PUBLIC_KEY_2048 2048
+#define SIZE_ZERO 0
+#define WRONG_SIZE 5
+
+/*ALL_TEE_TAG_LENGTH_FOR_AES*/
+#define AES_104_bits 104
+#define AES_112_bits 112
+#define AES_120_bits 120
+#define AES_128_bits 128
+#define AES_32_bits 32
+#define AES_48_bits 48
+#define AES_64_bits 64
+#define AES_96_bits 96
+
+/*attribute not defined*/
+#define TEE_ATTR_NONE 0
+
+static TEEC_SharedMemory *SHARE_MEM01;
+static TEEC_SharedMemory *SHARE_MEM02;
+static TEEC_SharedMemory *SHARE_MEM03;
+static TEEC_SharedMemory *SHARE_MEM04;
+static TEEC_SharedMemory *SHARE_MEM05;
+static TEEC_SharedMemory *SHARE_MEM06;
+static TEEC_Session *SESSION01;
+static TEEC_Session *SESSION02;
+static TEEC_Context *CONTEXT01;
+static TEEC_Context *CONTEXT02;
+static TEE_OperationHandle *OPERATION_HANDLE_01;
+static TEE_OperationHandle *OPERATION_HANDLE_02;
+static TEE_OperationHandle *OPERATION_HANDLE_INVALID;
+static TEE_ObjectHandle *OBJECT_HANDLE_01;
+static TEE_ObjectHandle *OBJECT_HANDLE_02;
+static TEE_ObjectHandle *OBJECT_HANDLE_INVALID;
+
+/*ALL_ATTRIBUTE_VALUES*/
+static const uint8_t TEE_ATTR_AES_256_VALUE01[] = {
+ 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0,
+ 0x85, 0x7d, 0x77, 0x81,
+ 0x1f, 0x35, 0x2c, 0x07, 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3d, 0x3e, 0x3f
+};
+static const uint8_t TEE_ATTR_DH_PUBLIC_VALUE_VALUE01[] = {
+ 0xbb, 0xe9, 0x18, 0xdd, 0x4b, 0x2b, 0x94, 0x1b, 0x10, 0x0e, 0x88, 0x35,
+ 0x28, 0x68, 0xfc, 0x62,
+ 0x04, 0x38, 0xa6, 0xdb, 0x32, 0xa6, 0x9e, 0xee, 0x6c, 0x6f, 0x45, 0x1c,
+ 0xa3, 0xa6, 0xd5, 0x37,
+ 0x77, 0x75, 0x5b, 0xc1, 0x37, 0x0a, 0xce, 0xfe, 0x2b, 0x8f, 0x13, 0xa9,
+ 0x14, 0x2c, 0x5b, 0x44,
+ 0x15, 0x78, 0x86, 0x30, 0xd6, 0x95, 0xb1, 0x92, 0x20, 0x63, 0xa3, 0xcf,
+ 0x9d, 0xef, 0x65, 0x61,
+ 0x27, 0x4d, 0x24, 0x01, 0xe7, 0xa1, 0x45, 0xf2, 0xd8, 0xb9, 0x3a, 0x45,
+ 0x17, 0xf4, 0x19, 0xd0,
+ 0x5e, 0xf8, 0xcb, 0x35, 0x59, 0x37, 0x9d, 0x04, 0x20, 0xa3, 0xbf, 0x02,
+ 0xad, 0xfe, 0xa8, 0x60,
+ 0xb2, 0xc3, 0xee, 0x85, 0x58, 0x90, 0xf3, 0xb5, 0x57, 0x2b, 0xb4, 0xef,
+ 0xd7, 0x8f, 0x37, 0x68,
+ 0x78, 0x7c, 0x71, 0x52, 0x9d, 0x5e, 0x0a, 0x61, 0x4f, 0x09, 0x89, 0x92,
+ 0x39, 0xf7, 0x4b, 0x01
+};
+static const uint8_t TEE_ATTR_DH_PRIVATE_VALUE_VALUE01[] = {
+ 0x53, 0x8d, 0x3d, 0x64, 0x27, 0x4a, 0x40, 0x05, 0x9b, 0x9c, 0x26, 0xe9,
+ 0x13, 0xe6, 0x91, 0x53,
+ 0x23, 0x7b, 0x55, 0x83
+};
+static const uint8_t TEE_ATTR_RSA_MODULUS_VALUE01[] = {
+ 0xf0, 0x1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5, 0x30, 0x65, 0x2f, 0x1c, 0x21, 0x39, 0xae, 0x1f,
+ 0xaf, 0x76, 0x8b, 0x83
+};
+static const uint8_t TEE_ATTR_DSA_SUBPRIME_VALUE01[] = {
+ 0x87, 0x44, 0xe4, 0xdd, 0xc6, 0xd0, 0x19, 0xa5, 0xea, 0xc2, 0xb1, 0x5a,
+ 0x15, 0xd7, 0xe1, 0xc7,
+ 0xf6, 0x63, 0x35, 0xf7
+};
+static const uint8_t TEE_ATTR_DSA_BASE_VALUE01[] = {
+ 0x9a, 0x09, 0x32, 0xb3, 0x8c, 0xb2, 0x10, 0x5b, 0x93, 0x00, 0xdc, 0xb8,
+ 0x66, 0xc0, 0x66, 0xd9,
+ 0xce, 0xc6, 0x43, 0x19, 0x2f, 0xcb, 0x28, 0x34, 0xa1, 0x23, 0x9d, 0xba,
+ 0x28, 0xbd, 0x09, 0xfe,
+ 0x01, 0x00, 0x1e, 0x04, 0x51, 0xf9, 0xd6, 0x35, 0x1f, 0x6e, 0x56, 0x4a,
+ 0xfb, 0xc8, 0xf8, 0xc3,
+ 0x9b, 0x10, 0x59, 0x86, 0x3e, 0xbd, 0x09, 0x85, 0x09, 0x0b, 0xd5, 0x5c,
+ 0x82, 0x8e, 0x9f, 0xc1,
+ 0x57, 0xac, 0x7d, 0xa3, 0xcf, 0xc2, 0x89, 0x2a, 0x0e, 0xd9, 0xb9, 0x32,
+ 0x39, 0x05, 0x82, 0xf2,
+ 0x97, 0x1e, 0x4a, 0x0c, 0x48, 0x3e, 0x06, 0x22, 0xd7, 0x31, 0x66, 0xbf,
+ 0x62, 0xa5, 0x9f, 0x26
+};
+static const uint8_t TEE_ATTR_DSA_PRIVATE_VALUE_VALUE01[] = {
+ 0x70, 0x4a, 0x46, 0xc6, 0x25, 0x2a, 0x95, 0xa3, 0x9b, 0x40, 0xe0, 0x43,
+ 0x5a, 0x69, 0x1b, 0xad,
+ 0xae, 0x52, 0xa5, 0xc0
+};
+static const uint8_t TEE_ATTR_DS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1c,
+ 0xfb, 0xdf, 0x29, 0x81, 0x10, 0x32, 0x02, 0xcc, 0x51, 0xa4, 0x17, 0x14,
+ 0x3e, 0xef, 0x89, 0x41,
+ 0xde, 0xf8, 0x2d, 0x64, 0x69, 0x30, 0xe8, 0x8a, 0xad, 0x96, 0xf6, 0xf4,
+ 0x82, 0x83, 0x9a, 0x77,
+ 0xe7, 0xde, 0x12, 0x31, 0xf7, 0x15, 0xec, 0xce, 0xed, 0x83, 0x68, 0x88,
+ 0x84, 0xe5, 0x64, 0x81
+};
+static const uint8_t TEE_ATTR_DES_64_VALUE01[] = {
+ 0xCD, 0xFE, 0x57, 0xB6, 0xB6, 0x2F, 0xAE, 0x6B
+};
+static const uint8_t TEE_ATTR_HMAC_SHA1_256_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f
+};
+static const uint8_t TEE_ATTR_HMAC_MD5_256_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f
+};
+static const uint8_t TEE_ATTR_HMAC_SHA224_256_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f
+};
+static const uint8_t TEE_ATTR_HMAC_SHA384_512_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
+ 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
+ 0x3c, 0x3d, 0x3e, 0x3f
+};
+static const uint8_t TEE_ATTR_HMAC_SHA512_512_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
+ 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
+ 0x3c, 0x3d, 0x3e, 0x3f
+};
+
+/*ALL_CRYPTO_AAD_VALUES*/
+static const uint8_t AAD1_VALUE[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
+};
+
+/*ALL_CRYPTO_AAD_LENGTHS*/
+#define AAD1_LENGTH 8
+#define NULL_LENGTH 0
+
+/*ALL_TEE_CRYPTO_INITIALISATION_VECTOR_VALUES*/
+static const uint8_t NONCE2_VALUE_AES_GCM[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88
+};
+static const uint8_t NONCE1_VALUE_AES_CCM[] = {
+ 0x00, 0x8D, 0x49, 0x3B, 0x30, 0xAE, 0x8B, 0x3C, 0x96, 0x96, 0x76, 0x6C,
+ 0xFA
+};
+
+/*ALL_TEE_CRYPTO_INITIALISATION_VECTOR_LENGTHS*/
+#define NONCE2_LENGTH_AES_GCM 12
+#define NONCE1_LENGTH_AES_CCM 13
+
+/*ALL_CRYPTO_DATA_VALUE*/
+static const uint8_t DATA_FOR_CRYPTO1[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0x08, 0x09,
+ 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04,
+ 0x03, 0x02, 0x01, 0x00,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0x08, 0x09,
+ 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04,
+ 0x03, 0x02, 0x01, 0x00
+};
+static const uint8_t DATA_FOR_CRYPTO1_PART1[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0x08, 0x09
+};
+static const uint8_t DATA_FOR_CRYPTO1_PART2[] = {
+ 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04,
+ 0x03, 0x02, 0x01, 0x00,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F
+};
+static const uint8_t DATA_FOR_CRYPTO1_PART3[] = {
+ 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+ 0x06, 0x07, 0x08, 0x09,
+ 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04,
+ 0x03, 0x02, 0x01, 0x00
+};
+
+/*ALL_CRYPTO_DATA_LENGTH*/
+#define LENGTH_DATA_FOR_CRYPTO1 96
+#define LENGTH_DATA_FOR_CRYPTO1_PART1 32
+#define LENGTH_DATA_FOR_CRYPTO1_PART2 32
+#define LENGTH_DATA_FOR_CRYPTO1_PART3 32
+
+/*ALL_TEE_CRYPTO_INITIALISATION_VECTOR_VALUES*/
+static const uint8_t IV1_VALUE_64bits_DES_DES3[] = {
+ 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef
+};
+static const uint8_t IV2_VALUE_128bits_AES[] = {
+ 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef, 0x12, 0x34, 0x56, 0x78,
+ 0x90, 0xab, 0xcd, 0xef
+};
+static const uint8_t IV_INVALID_LENGTH_VALUE[] = {
+ 0x01, 0x02, 0x03, 0x04, 0x05
+};
+
+/*ALL_TEE_CRYPTO_INITIALISATION_VECTOR_LENGTHS*/
+#define IV_LENGTH_NULL 0
+#define IV_INVALID_LENGTH 5
+#define IV1_LENGTH_64bits_DES_DES3 8
+#define IV2_LENGTH_128bits_AES 16
+
+static const uint8_t *TEE_ATTR_VALUE_NONE;
+
+/*ALL_TEE_BUFFER_CASES*/
+#define OUTPUT_BUFFER_NORMAL 1
+#define OUTPUT_BUFFER_TOO_SHORT 2
+#define OUTPUT_OTHER_BUFFER_TOO_SHORT 3
+
+enum signature_validity {
+ INVALID_SIGNATURE = 0,
+ VALID_SIGNATURE
+};
+
+enum mac_validity {
+ INVALID_MAC = 0,
+ VALID_MAC
+};
+
+struct crypto_buffer {
+ uint8_t *buffer;
+ uint32_t size;
+};
+
+/*Saved in Invoke_Crypto_AllocateOperation*/
+struct crypto_op {
+ uint32_t algo;
+ uint32_t mode;
+ uint32_t obj_size;
+};
+struct crypto_op saved_alloc;
+
+/*Saved in Invoke_Crypto_InitObjectWithKeys*/
+struct key_val {
+ TEE_ObjectHandle obh;
+ uint32_t obj_type;
+ uint32_t obj_size;
+ struct crypto_buffer key;
+};
+struct key_val saved_key_vals;
+
+/*Saved in Invoke_Crypto_SetOperationKey*/
+struct obh_val {
+ TEE_OperationHandle oph;
+ TEE_ObjectHandle obh;
+};
+struct obh_val saved_obh1;
+
+/*Saved in Invoke_Crypto_SetOperationKey2*/
+struct obh_val2 {
+ TEE_OperationHandle oph;
+ TEE_ObjectHandle obh1;
+ TEE_ObjectHandle obh2;
+};
+struct obh_val2 saved_obh;
+
+/*saved by Invoke_Crypto_AEUpdateAAD*/
+struct crypto_buffer saved_aad_value;
+
+/*Saved in Invoke_Crypto_AEEncryptFinal*/
+struct crypto_buffer ae_encrypt_tag;
+
+/*Saved in Invoke_Crypto_AEUpdate_for_encryption*/
+struct crypto_buffer buffer_encrypted_chunks[4];
+
+/*Saved in Invoke_Crypto_AEUpdate_for_Decryption*/
+struct crypto_buffer buffer_decrypted_chunks[4];
+
+/*filled with data in Invoke_Crypto_AsymmetricEncrypt*/
+struct crypto_buffer buffer_asym_encrypted;
+
+/*saved by Invoke_Crypto_AEInit*/
+struct crypto_buffer saved_in_nonce;
+
+/*Saved in Invoke_Crypto_DeriveKey*/
+struct obh_val saved_derive;
+
+/*Saved in Invoke_Crypto_GenerateRandom*/
+struct crypto_buffer saved_random;
+
+/*Saved in Invoke_Crypto_DigestDoFinal*/
+struct crypto_buffer saved_digest;
+
+/*Saved in Invoke_Crypto_MACInit*/
+struct crypto_buffer saved_mac_iv;
+
+/*Saved in Invoke_Crypto_CipherInit*/
+struct crypto_buffer saved_cipher_iv;
+
+/*Saved in Invoke_Crypto_CipherUpdate*/
+struct crypto_buffer saved_cipher_update;
+
+
+TEEC_UUID UUID_TTA_testingInternalAPI_crypto = {
+ 0x534D4152, 0x5443, 0x534C,
+ { 0x54, 0x43, 0x52, 0x59, 0x50, 0x54, 0x4F, 0x31 }
+};
+
+/* CRYPTO API HELPERS */
+#define TEEC_SelectApp(a, b) /*do nothing for now*/
+
+static void crypto_init(void)
+{
+ saved_obh.oph = 0;
+ saved_obh.obh1 = 0;
+ saved_obh.obh2 = 0;
+ saved_alloc.algo = 0;
+ saved_alloc.mode = 0;
+ saved_alloc.obj_size = 0;
+ saved_key_vals.obh = 0;
+ saved_key_vals.obj_size = 0;
+ saved_key_vals.obj_type = 0;
+ CRYPTO_INIT(saved_key_vals.key);
+ CRYPTO_INIT(saved_aad_value);
+ CRYPTO_INIT(ae_encrypt_tag);
+ /*4 chunks*/
+ CRYPTO_INIT(buffer_encrypted_chunks[0]);
+ CRYPTO_INIT(buffer_encrypted_chunks[1]);
+ CRYPTO_INIT(buffer_encrypted_chunks[2]);
+ CRYPTO_INIT(buffer_encrypted_chunks[3]);
+ /*4 chunks*/
+ CRYPTO_INIT(buffer_decrypted_chunks[0]);
+ CRYPTO_INIT(buffer_decrypted_chunks[1]);
+ CRYPTO_INIT(buffer_decrypted_chunks[2]);
+ CRYPTO_INIT(buffer_decrypted_chunks[3]);
+ CRYPTO_INIT(buffer_asym_encrypted);
+ CRYPTO_INIT(saved_in_nonce);
+ CRYPTO_INIT(saved_random);
+ CRYPTO_INIT(saved_digest);
+ CRYPTO_INIT(saved_cipher_iv);
+ CRYPTO_INIT(saved_cipher_update);
+}
+
+static void crypto_reset(void)
+{
+ saved_obh.oph = 0;
+ saved_obh.obh1 = 0;
+ saved_obh.obh2 = 0;
+ saved_alloc.algo = 0;
+ saved_alloc.mode = 0;
+ saved_alloc.obj_size = 0;
+ saved_key_vals.obh = 0;
+ saved_key_vals.obj_size = 0;
+ saved_key_vals.obj_type = 0;
+ CRYPTO_FREE(saved_key_vals.key);
+
+ CRYPTO_FREE(saved_aad_value);
+ CRYPTO_FREE(ae_encrypt_tag);
+ /*4 chunks*/
+ CRYPTO_FREE(buffer_encrypted_chunks[0]);
+ CRYPTO_FREE(buffer_encrypted_chunks[1]);
+ CRYPTO_FREE(buffer_encrypted_chunks[2]);
+ CRYPTO_FREE(buffer_encrypted_chunks[3]);
+ /*4 chunks*/
+ CRYPTO_FREE(buffer_decrypted_chunks[0]);
+ CRYPTO_FREE(buffer_decrypted_chunks[1]);
+ CRYPTO_FREE(buffer_decrypted_chunks[2]);
+ CRYPTO_FREE(buffer_decrypted_chunks[3]);
+ CRYPTO_FREE(buffer_asym_encrypted);
+ CRYPTO_FREE(saved_in_nonce);
+ CRYPTO_FREE(saved_random);
+ CRYPTO_FREE(saved_digest);
+ CRYPTO_FREE(saved_cipher_iv);
+ CRYPTO_FREE(saved_cipher_update);
+}
+
+/*Helper functions/macros*/
+
+#define ALLOCATE_SHARED_MEMORY(context, sharedMemory, sharedMemorySize, \
+ memoryType) \
+ res = AllocateSharedMemory(context, sharedMemory, sharedMemorySize, \
+ memoryType); \
+ if (res != TEEC_SUCCESS) { \
+ goto exit; \
+ } \
+ memset(sharedMemory->buffer, 0, sharedMemorySize);
+
+#define ALLOCATE_AND_FILL_SHARED_MEMORY(context, sharedMemory, \
+ sharedMemorySize, \
+ memoryType, copySize, data) \
+ res = AllocateSharedMemory(context, sharedMemory, sharedMemorySize, \
+ memoryType); \
+ if (res != TEEC_SUCCESS) { \
+ goto exit; \
+ } \
+ memset(sharedMemory->buffer, 0, sharedMemorySize); \
+ if (data != NULL) { \
+ memcpy(sharedMemory->buffer, data, copySize); \
+ }
+
+#define SET_SHARED_MEMORY_OPERATION_PARAMETER(parameterNumber, \
+ sharedMemoryOffset, \
+ sharedMemory, \
+ sharedMemorySize) \
+ op.params[parameterNumber].memref.offset = sharedMemoryOffset; \
+ op.params[parameterNumber].memref.size = sharedMemorySize; \
+ op.params[parameterNumber].memref.parent = sharedMemory;
+
+/*Allocates TEEC_SharedMemory inside of the TEE*/
+static TEEC_Result AllocateSharedMemory(TEEC_Context *ctx,
+ TEEC_SharedMemory *shm, uint32_t size,
+ uint32_t flags)
+{
+ shm->flags = flags;
+ shm->size = size;
+ return TEEC_AllocateSharedMemory(ctx, shm);
+}
+
+/**
+ * Writes 4 byte to @p *data_pp and increases
+ * @p *data_pp by 4 byte. The bytes are written
+ * in Big Endian Order.
+ */
+static void put_uint32_be(void **data_pp, uint32_t v)
+{
+ uint8_t *d = *(uint8_t **)data_pp;
+ uint8_t *v_p = (uint8_t *)&v;
+
+ d[3] = v_p[0];
+ d[2] = v_p[1];
+ d[1] = v_p[2];
+ d[0] = v_p[3];
+ *((uint8_t **)data_pp) += sizeof(uint32_t);
+}
+
+static TEEC_Result calculate_digest(ADBG_Case_t *c, TEEC_Session *s,
+ const void *data, const size_t data_length,
+ struct crypto_buffer *digest);
+
+static TEEC_Result sign_digest(ADBG_Case_t *c, TEEC_Session *s,
+ const struct crypto_buffer *in_dgst,
+ struct crypto_buffer *out_dgst);
+
+static bool verify_digest(ADBG_Case_t *c, TEEC_Session *s,
+ const struct crypto_buffer *in_sdgst);
+
+static TEEC_Result mac_compute_final(ADBG_Case_t *c, TEEC_Session *s,
+ const void *full_data,
+ const size_t fdata_length,
+ struct crypto_buffer *mac);
+
+static TEEC_Result cipher_do_final(ADBG_Case_t *c, TEEC_Session *s,
+ const void *full_data,
+ const size_t fdata_length,
+ struct crypto_buffer *cipher);
+
+static void collapse_crypto_buffers(struct crypto_buffer *in_buffer,
+ struct crypto_buffer *out_buffer)
+{
+ int id;
+ uint8_t *tmp;
+
+ out_buffer->size = 0;
+
+ for (id = 0; id < 4; id++)
+ out_buffer->size += in_buffer[id].size;
+
+ out_buffer->buffer = malloc(out_buffer->size);
+ tmp = out_buffer->buffer;
+
+ for (id = 0; id < 4; id++) {
+ if (in_buffer[id].buffer) {
+ memcpy(tmp, in_buffer[id].buffer, in_buffer[id].size);
+ tmp += in_buffer[id].size;
+ }
+ }
+}
+
+/*Invoke Crypto Commands Implementations*/
+/*CMD_AllocateOperation*/
+static TEEC_Result Invoke_Crypto_AllocateOperation(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id,
+ const uint32_t algo, const uint32_t mode,
+ const size_t obj_size1, const size_t obj_size2,
+ TEE_OperationHandle *oph)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = algo;
+ op.params[0].value.b = mode;
+ op.params[1].value.a = obj_size1 + obj_size2;
+ op.params[3].value.a = (uint32_t)*oph;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_VALUE_INPUT,
+ TEEC_NONE, TEEC_VALUE_INPUT);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Store this information about mode and algorithm
+ * in order to do cryptographic operation later
+ */
+ if (res == TEEC_SUCCESS) {
+ saved_alloc.algo = algo;
+ saved_alloc.mode = mode;
+ saved_alloc.obj_size = obj_size1 + obj_size2;
+ }
+
+ return res;
+}
+
+/*CMD_GetOperationInfo*/
+static TEEC_Result Invoke_Crypto_GetOperationInfo(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph, const uint32_t algo,
+ uint32_t op_class, TEE_OperationMode op_mod,
+ const size_t dgst_length, const size_t obj1_size,
+ const size_t obj2_size,
+ const size_t key_size, uint32_t key_usage,
+ bool two_keys, bool key_set, bool initialized)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)*oph;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INOUT, TEEC_VALUE_OUTPUT,
+ TEEC_VALUE_OUTPUT, TEEC_VALUE_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ ADBG_EXPECT(c, op.params[0].value.a, algo);
+ ADBG_EXPECT(c, op.params[0].value.b, op_class);
+ ADBG_EXPECT(c, op.params[1].value.a, (uint32_t)op_mod);
+ ADBG_EXPECT(c, op.params[1].value.b, dgst_length);
+ ADBG_EXPECT(c, op.params[2].value.a, obj1_size + obj2_size);
+ ADBG_EXPECT(c, op.params[2].value.b, key_size);
+ ADBG_EXPECT(c, op.params[3].value.a, key_usage);
+
+ if (two_keys && key_set && initialized) {
+ ADBG_EXPECT(c, op.params[3].value.b,
+ 0x00020000 | 0x00040000 | 0x00080000);
+ } else if (two_keys && key_set) {
+ ADBG_EXPECT(c, op.params[3].value.b,
+ 0x00020000 | 0x00040000);
+ } else if (two_keys && initialized) {
+ ADBG_EXPECT(c, op.params[3].value.b,
+ 0x00020000 | 0x00080000);
+ } else if (key_set && initialized) {
+ ADBG_EXPECT(c, op.params[3].value.b,
+ 0x00040000 | 0x00080000);
+ }
+ }
+
+ return res;
+}
+
+/*CMD_ResetOperation*/
+static TEEC_Result Invoke_Crypto_ResetOperation(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)*oph;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ return res;
+}
+
+/*CMD_FreeAllKeysAndOperations*/
+static TEEC_Result Invoke_Crypto_FreeAllKeysAndOperations(
+ ADBG_Case_t *c,
+ TEEC_Session *s,
+ uint32_t cmd_id,
+ TEE_OperationHandle *oph)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)*oph;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ return res;
+}
+
+/*CMD_InitObjectWithKeys*/
+static TEEC_Result Invoke_Crypto_InitObjectWithKeys(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, const uint32_t obj_type, const uint32_t obj_size,
+ const uint32_t attributeId_1, const void *attribValue_1,
+ const uint32_t attribSize_1,
+ const uint32_t attributeId_2, const void *attribValue_2,
+ const uint32_t attribSize_2,
+ const uint32_t attributeId_3, const void *attribValue_3,
+ const uint32_t attribSize_3,
+ const uint32_t attributeId_4, const void *attribValue_4,
+ const uint32_t attribSize_4,
+ const uint32_t attributeId_5, const void *attribValue_5,
+ const uint32_t attribSize_5,
+ TEE_ObjectHandle *obh)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ void *tmp_buf1 = NULL;
+ uint8_t *tmp_buf2 = NULL;
+ int tmp_offset = 0;
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT)
+
+ /* Serialize the data in format:
+ * SHARE_MEM01 = (uint32_t)attr_id1|(uint32_t)attr_val1_offset
+ * in SHARE_MEM02|(uint32_t)attr_val1_length
+ * Add 0 for all three if attr_idX = TEE_ATTR_NONE
+ */
+ /* Serialize the data in format:
+ * SHARE_MEM02 = attr_val1|attr_val2|attr_val3|attr_val4|attr_val5.
+ * Do not add anything if attr_valX == TEE_ATTR_VALUE_NONE.
+ */
+
+ tmp_buf1 = SHARE_MEM01->buffer;
+ tmp_buf2 = (uint8_t *)SHARE_MEM02->buffer;
+ put_uint32_be(&tmp_buf1, attributeId_1);
+
+ if (TEE_ATTR_NONE != attributeId_1) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_1);
+ memcpy(tmp_buf2, attribValue_1, (size_t)attribSize_1);
+ tmp_buf2 += attribSize_1;
+ tmp_offset += attribSize_1;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_2);
+
+ if (TEE_ATTR_NONE != attributeId_2) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_2);
+ memcpy(tmp_buf2, attribValue_2, (size_t)attribSize_2);
+ tmp_buf2 += attribSize_2;
+ tmp_offset += attribSize_2;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_3);
+
+ if (TEE_ATTR_NONE != attributeId_3) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_3);
+ memcpy(tmp_buf2, attribValue_3, (size_t)attribSize_3);
+ tmp_buf2 += attribSize_3;
+ tmp_offset += attribSize_3;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_4);
+
+ if (TEE_ATTR_NONE != attributeId_4) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_4);
+ memcpy(tmp_buf2, attribValue_4, (size_t)attribSize_4);
+ tmp_buf2 += attribSize_4;
+ tmp_offset += attribSize_4;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_5);
+
+ if (TEE_ATTR_NONE != attributeId_5) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_5);
+ memcpy(tmp_buf2, attribValue_5, (size_t)attribSize_5);
+ tmp_buf2 += attribSize_5;
+ tmp_offset += attribSize_5;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ op.params[0].value.a = obj_type;
+ op.params[0].value.b = obj_size;
+ /* 5 attributes
+ * 12 bytes = 4 attr_id + 4 attr_offset + 4 attr_length
+ */
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01, 60)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02, tmp_offset)
+ op.params[3].value.a = (uint32_t)*obh;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_VALUE_INPUT);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Store the key values associated with ObjectHandle in
+ * order to perform cryptographic computation later
+ */
+ if (res == TEEC_SUCCESS) {
+ saved_key_vals.obj_type = obj_type;
+ saved_key_vals.obj_size = obj_size;
+ saved_key_vals.obh = *obh;
+
+ CRYPTO_FREE(saved_key_vals.key);
+ saved_key_vals.key.size = tmp_offset;
+ saved_key_vals.key.buffer = malloc(tmp_offset);
+ memcpy(saved_key_vals.key.buffer, SHARE_MEM02->buffer,
+ tmp_offset);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+
+ return res;
+}
+
+/*CMD_SetOperationKey*/
+static TEEC_Result Invoke_Crypto_SetOperationKey(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph, TEE_ObjectHandle *obh)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)*oph;
+ op.params[0].value.b = (uint32_t)*obh;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* store the information about which key object handle are associated
+ * with Operation Handle in order to perform cryptographic
+ * computation later
+ */
+ if (res == TEEC_SUCCESS) {
+ saved_obh.oph = *oph;
+ saved_obh.obh1 = *obh;
+ saved_obh.obh2 = TEE_HANDLE_NULL;
+ }
+
+ return res;
+}
+
+/*CMD_SetOperationKey2*/
+static TEEC_Result Invoke_Crypto_SetOperationKey2(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ TEE_ObjectHandle *obh1, TEE_ObjectHandle *obh2)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)*oph;
+ op.params[0].value.b = (uint32_t)*obh1;
+ op.params[1].value.a = (uint32_t)*obh2;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_VALUE_INPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Store the information about which key object handles are associated
+ * with Operation Handle in order to perform cryptographic
+ * computation later
+ */
+ if (res == TEEC_SUCCESS) {
+ saved_obh.oph = *oph;
+ saved_obh.obh1 = *obh1;
+ saved_obh.obh2 = *obh2;
+ }
+
+ return res;
+}
+
+/*CMD_DeriveKey*/
+static TEEC_Result Invoke_Crypto_DeriveKey(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph, TEE_ObjectHandle *obh)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)*oph;
+ op.params[0].value.b = (uint32_t)*obh;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Save the fact that the object has been derived for later
+ * cryptographic computation
+ */
+ if (res == TEEC_SUCCESS) {
+ saved_derive.oph = *oph;
+ saved_derive.obh = *obh;
+ }
+
+ return res;
+}
+
+/*CMD_AEInit*/
+static TEEC_Result Invoke_Crypto_AEInit(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *nonce_val, const size_t nonce_length,
+ const size_t in_tag_len, const size_t in_aad_len,
+ const size_t in_payload_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, nonce_length,
+ TEEC_MEMREF_PARTIAL_INPUT, nonce_length,
+ nonce_val)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ op.params[0].value.b = in_tag_len;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ op.params[2].value.a = in_aad_len;
+ op.params[2].value.b = in_payload_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_VALUE_INPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Save the $IN_nonce$ for later computation of encryptedData
+ */
+ if (res == TEEC_SUCCESS) {
+ saved_in_nonce.buffer = malloc(nonce_length);
+ saved_in_nonce.size = nonce_length;
+ memcpy(saved_in_nonce.buffer, nonce_val, nonce_length);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+/*CMD_AEUpdate*/
+static TEEC_Result Invoke_Crypto_AEUpdate_for_encryption(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length,
+ const uint32_t case_buf, const uint32_t chunk_id)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ /*if $IN_caseBuffer$ = OUTPUT_BUFFER_TOO_SHORT(2)
+ then Param[3].memref.size=1 */
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Store the buffer from "shm2" in
+ * "buffer_encrypted_chunks[$IN_chunkNumber$]"
+ * which will be reused for the
+ * Invoke_Crypto_TEE_AEUpdate_for_decryption function
+ */
+ if (res == TEEC_SUCCESS) {
+ buffer_encrypted_chunks[chunk_id].size =
+ op.params[3].memref.size;
+ buffer_encrypted_chunks[chunk_id].buffer = malloc(
+ buffer_encrypted_chunks[chunk_id].size);
+ memcpy(buffer_encrypted_chunks[chunk_id].buffer,
+ SHARE_MEM02->buffer,
+ buffer_encrypted_chunks[chunk_id].size);
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+/*CMD_AEUpdate*/
+
+static TEEC_Result Invoke_Crypto_AEUpdate_for_decryption(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length,
+ const uint32_t case_buf, const uint32_t chunk_id)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ buffer_encrypted_chunks[chunk_id].size,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ buffer_encrypted_chunks[chunk_id].size,
+ buffer_encrypted_chunks[chunk_id].
+ buffer)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, partd_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01, partd_length)
+ /*if $IN_caseBuffer$ = OUTPUT_BUFFER_TOO_SHORT(2)
+ then Param[3].memref.size=1*/
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Save the buffer from "SharedMem2" into
+ * "buffer_decrypted_chunks[$IN_chunkNumber$]"
+ * in order to collapse all buffers returned for
+ * AEUpdate_for_decryption,
+ * which will be used in AEDecryptFinal
+ */
+ if (res == TEEC_SUCCESS) {
+ buffer_decrypted_chunks[chunk_id].size =
+ op.params[3].memref.size;
+ buffer_decrypted_chunks[chunk_id].buffer = malloc(
+ buffer_decrypted_chunks[chunk_id].size);
+ memcpy(buffer_decrypted_chunks[chunk_id].buffer,
+ SHARE_MEM02->buffer,
+ buffer_decrypted_chunks[chunk_id].size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_AEUpdateAAD*/
+static TEEC_Result Invoke_Crypto_AEUpdateAAD(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *aad_data, const size_t aad_length)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, aad_length,
+ TEEC_MEMREF_PARTIAL_INPUT, aad_length,
+ aad_data)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Save the $IN_AAD_Value$ for AAD for later cryptographic computation
+ */
+ if (res == TEEC_SUCCESS) {
+ saved_aad_value.buffer = malloc(aad_length);
+ saved_aad_value.size = aad_length;
+ memcpy(saved_aad_value.buffer, aad_data, aad_length);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+/*CMD_AEEncryptFinal*/
+static TEEC_Result Invoke_Crypto_AEEncryptFinal(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length,
+ const void *full_data, const size_t fdata_length,
+ uint32_t case_buf, uint32_t chunk_id)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_partd_size, initial_fdata_size;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, fdata_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, partd_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ switch (case_buf) {
+ case OUTPUT_BUFFER_TOO_SHORT:
+ /*if $IN_caseBuffer$ =
+ OUTPUT_BUFFER_TOO_SHORT(2) then Param[3].memref.size=1*/
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ break;
+ case OUTPUT_OTHER_BUFFER_TOO_SHORT:
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM03, 1)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ break;
+ case OUTPUT_BUFFER_NORMAL:
+ default:
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ break;
+ }
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_OUTPUT,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_partd_size = op.params[2].memref.size;
+ initial_fdata_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Store the buffer from "shm2" in
+ * "buffer_encrypted_chunks[$IN_chunkNumber$]"
+ * which will be reused for
+ * the Invoke_Crypto_TEE_AEDecryptFinal function
+ */
+ buffer_encrypted_chunks[chunk_id].size =
+ op.params[3].memref.size;
+ buffer_encrypted_chunks[chunk_id].buffer = malloc(
+ buffer_encrypted_chunks[chunk_id].size);
+ memcpy(buffer_encrypted_chunks[chunk_id].buffer,
+ SHARE_MEM02->buffer,
+ buffer_encrypted_chunks[chunk_id].size);
+
+ /* Store the tag from "SharedMem3" which will be reused for the
+ * Invoke_Crypto_TEE_AEDecryptFinal function
+ */
+ ae_encrypt_tag.size = op.params[2].memref.size;
+ ae_encrypt_tag.buffer = malloc(ae_encrypt_tag.size);
+ memcpy(ae_encrypt_tag.buffer, SHARE_MEM03->buffer,
+ ae_encrypt_tag.size);
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ if (initial_partd_size == op.params[2].memref.size)
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_fdata_size, <,
+ op.params[3].memref.size);
+ else
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_partd_size, <,
+ op.params[2].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+/*CMD_AEDecryptFinal*/
+static TEEC_Result Invoke_Crypto_AEDecryptFinal(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length,
+ const void *full_data, const size_t fdata_length,
+ const uint32_t case_buf, const enum mac_validity mac_case,
+ const uint32_t chunk_id)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ buffer_encrypted_chunks[chunk_id].size,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ buffer_encrypted_chunks[chunk_id].size,
+ buffer_encrypted_chunks[chunk_id].
+ buffer)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, partd_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ae_encrypt_tag.size,
+ TEEC_MEMREF_PARTIAL_INPUT)
+ /* Fill "SharedMem3" with the tag previously
+ * saved in Invoke_Crypto_AEEncryptFinal
+ * (with an error (one bit changed) if $IN_caseMac$ = INVALID_MAC)
+ */
+ if (ae_encrypt_tag.buffer != NULL) {
+ memcpy(SHARE_MEM03->buffer, ae_encrypt_tag.buffer,
+ ae_encrypt_tag.size);
+
+ if (mac_case == INVALID_MAC)
+ BIT_CHANGE(*(uint32_t *)SHARE_MEM03->buffer, 4);
+ }
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+ /*if $IN_caseBuffer$ = OUTPUT_BUFFER_TOO_SHORT(2)
+ then Param[3].memref.size=1*/
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Save the buffer from "SharedMem2" to
+ * "buffer_decrypted_chunks[$IN_chunkNumber$]"
+ */
+ buffer_decrypted_chunks[chunk_id].size =
+ op.params[3].memref.size;
+ buffer_decrypted_chunks[chunk_id].buffer = malloc(
+ buffer_decrypted_chunks[chunk_id].size);
+ memcpy(buffer_decrypted_chunks[chunk_id].buffer,
+ SHARE_MEM02->buffer,
+ buffer_decrypted_chunks[chunk_id].size);
+
+ /* Compare the data in clear $IN_fullDataValue$ and with
+ * collapsed buffers from table
+ * "buffer_decrypted_chunks" and check they are equals
+ */
+ struct crypto_buffer collapsed;
+ CRYPTO_INIT(collapsed);
+ collapse_crypto_buffers(buffer_decrypted_chunks, &collapsed);
+ ADBG_EXPECT_BUFFER(c, full_data, fdata_length, collapsed.buffer,
+ collapsed.size);
+ CRYPTO_FREE(collapsed);
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+/*CMD_GenerateRandom*/
+static TEEC_Result Invoke_Crypto_GenerateRandom(ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_NONE, TEEC_NONE, TEEC_NONE,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Check that the buffer shm1 is not empty
+ * + Check that this random value is
+ * different of a previous call of this command
+ */
+ if (res == TEEC_SUCCESS) {
+ if (ADBG_EXPECT_COMPARE_SIGNED(c, 0, !=,
+ op.params[3].memref.size)) {
+ if (saved_random.buffer != NULL) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, 0, !=,
+ memcmp(
+ SHARE_MEM01
+ ->
+ buffer,
+ saved_random
+ .
+ buffer,
+ op.
+ params[3].
+ memref.
+ size));
+ free(saved_random.buffer);
+ saved_random.size = 0;
+ }
+
+ saved_random.size = op.params[3].memref.size;
+ saved_random.buffer = malloc(saved_random.size);
+ memcpy(saved_random.buffer, SHARE_MEM01->buffer,
+ saved_random.size);
+ }
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+/*CMD_DigestUpdate*/
+static TEEC_Result Invoke_Crypto_DigestUpdate(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+/*CMD_DigestDoFinal*/
+static TEEC_Result Invoke_Crypto_DigestDoFinal(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length,
+ const void *full_data, const size_t fdata_length,
+ const uint32_t case_buf)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, fdata_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Compute the hash of $IN_fullDataValue$
+ * and compare it to "shm2"
+ */
+ struct crypto_buffer tmp_dgst;
+ CRYPTO_INIT(tmp_dgst);
+ ADBG_EXPECT_TEEC_SUCCESS(c, res =
+ calculate_digest(c, s,
+ full_data,
+ fdata_length,
+ &tmp_dgst));
+ ADBG_EXPECT_BUFFER(c, tmp_dgst.buffer, tmp_dgst.size,
+ SHARE_MEM02->buffer, tmp_dgst.size);
+
+ /* Store the Digest value which can be reused for a next call to
+ * TEE_AsymmetricSignDigest or TEE_AsymmetricVerifyDigest
+ */
+ CRYPTO_FREE(saved_digest);
+ saved_digest.size = op.params[3].memref.size;
+ saved_digest.buffer = malloc(saved_digest.size);
+ memcpy(saved_digest.buffer, SHARE_MEM02->buffer,
+ saved_digest.size);
+ CRYPTO_FREE(tmp_dgst);
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_AsymmetricSignDigest*/
+static TEEC_Result Invoke_Crypto_AsymmetricSignDigest(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *full_data, const size_t fdata_length, uint32_t case_buf)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ /* Fill SharedMem1 with the previously stored Digest
+ value after TEE_DigestDoFinal */
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, fdata_length,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ saved_digest.size, saved_digest.buffer)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, 512,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ saved_digest.size)
+ /*if $IN_caseBuffer$ = OUTPUT_BUFFER_TOO_SHORT(2)
+ then Param[3].memref.size=1*/
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Compute a Verify_Signature of the signature
+ * store under "SharedMem2"
+ */
+ struct crypto_buffer s_dgst;
+ CRYPTO_INIT(s_dgst);
+ s_dgst.size = op.params[3].memref.size;
+ s_dgst.buffer = malloc(s_dgst.size);
+ memcpy(s_dgst.buffer, SHARE_MEM02->buffer, s_dgst.size);
+ ADBG_EXPECT(c, true, verify_digest(c, s, &s_dgst));
+ CRYPTO_FREE(s_dgst);
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_AsymmetricVerifyDigest*/
+static TEEC_Result Invoke_Crypto_AsymmetricVerifyDigest(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *full_data, const size_t fdata_length,
+ const uint32_t valid_sig)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, fdata_length,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ saved_digest.size, saved_digest.buffer)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, 512,
+ TEEC_MEMREF_PARTIAL_INPUT)
+
+ struct crypto_buffer signed_dgst;
+ CRYPTO_INIT(signed_dgst);
+ res = sign_digest(c, s, &saved_digest, &signed_dgst);
+
+ /* Fill "SharedMem2" with the valid computed signature based on
+ * the previously stored Digest value after TEE_DigestDoFinal
+ */
+ if (signed_dgst.buffer != NULL) {
+ memcpy(SHARE_MEM02->buffer, signed_dgst.buffer,
+ signed_dgst.size);
+
+ if (valid_sig != VALID_SIGNATURE) {
+ /*make it invalid*/
+ BIT_CHANGE(*(uint32_t *)SHARE_MEM02->buffer, 4);
+ }
+ }
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ saved_digest.size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ signed_dgst.size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_MEMREF_PARTIAL_INPUT);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ CRYPTO_FREE(signed_dgst);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_AsymmetricEncrypt*/
+static TEEC_Result Invoke_Crypto_AsymmetricEncrypt(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *full_data, const size_t fdata_length, uint32_t case_buf)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ /* Fill SharedMem1 with full_data */
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, fdata_length,
+ TEEC_MEMREF_PARTIAL_INPUT, fdata_length,
+ full_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, 512,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ /*if $IN_caseBuffer$ = OUTPUT_BUFFER_TOO_SHORT(2)
+ then Param[3].memref.size=1*/
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Check that "SharedMem2" is not empty
+ * Store the value from "SharedMem2" to a
+ * "buffer_asym_encrypted",
+ * which will be reused in Invoke_Crypto_AsymmetricDecrypt
+ */
+ if (ADBG_EXPECT_COMPARE_SIGNED(c, 0, !=,
+ op.params[3].memref.size)) {
+ buffer_asym_encrypted.size = op.params[3].memref.size;
+ buffer_asym_encrypted.buffer = malloc(
+ buffer_asym_encrypted.size);
+ memcpy(buffer_asym_encrypted.buffer,
+ SHARE_MEM02->buffer, buffer_asym_encrypted.size);
+ }
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_AsymmetricDecrypt*/
+static TEEC_Result Invoke_Crypto_AsymmetricDecrypt(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *full_data, const size_t fdata_length, uint32_t case_buf)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ /* Fill SharedMem1 with buffer_asym_encrypted */
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, fdata_length,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ buffer_asym_encrypted.size,
+ buffer_asym_encrypted.buffer)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, 512,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ buffer_asym_encrypted.size)
+ /*if $IN_caseBuffer$ = OUTPUT_BUFFER_TOO_SHORT(2)
+ then Param[3].memref.size=1*/
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Compare the clear data in
+ * $IN_fullDataValue$ with "SharedMem2"
+ * and check they are equal
+ */
+ ADBG_EXPECT_BUFFER(c, full_data, fdata_length,
+ SHARE_MEM02->buffer,
+ op.params[3].memref.size);
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_CopyOperation*/
+static TEEC_Result Invoke_Crypto_CopyOperation(
+ ADBG_Case_t *c, TEEC_Session *s, const uint32_t cmd_id,
+ TEE_OperationHandle *dst_oph, TEE_OperationHandle *src_oph)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)*dst_oph;
+ op.params[0].value.b = (uint32_t)*src_oph;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ return res;
+}
+
+/*CMD_MACInit*/
+static TEEC_Result Invoke_Crypto_MACInit(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *iv, const size_t iv_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM06, iv_len,
+ TEEC_MEMREF_PARTIAL_INPUT, iv_len, iv)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM06, iv_len)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* save the $IN_InitialisationVector$ for
+ * later computation of encryptedData
+ */
+ if (iv_len != 0) {
+ CRYPTO_FREE(saved_mac_iv);
+ saved_mac_iv.size = iv_len;
+ saved_mac_iv.buffer = malloc(iv_len);
+ memcpy(saved_mac_iv.buffer, iv, iv_len);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM06);
+ return res;
+}
+
+/*CMD_MACUpdate*/
+static TEEC_Result Invoke_Crypto_MACUpdate(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+/*CMD_MACCompareFinal*/
+static TEEC_Result Invoke_Crypto_MACCompareFinal(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length,
+ const void *full_data, const size_t fdata_length,
+ enum mac_validity mac_case)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ /* Fill SharedMem1 with part_data */
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, fdata_length,
+ TEEC_MEMREF_PARTIAL_INPUT)
+
+ /* Fill SharedMem2 with valid computed MAC of full_data */
+ struct crypto_buffer mac;
+ CRYPTO_INIT(mac);
+ res = mac_compute_final(c, s, full_data, fdata_length, &mac);
+
+ if (mac.buffer != NULL) {
+ memcpy(SHARE_MEM02->buffer, mac.buffer, mac.size);
+
+ if (mac_case != VALID_MAC) {
+ /* change one bit from the valid
+ MAC to make it invalid. */
+ BIT_CHANGE(*(uint32_t *)SHARE_MEM02->buffer, 4);
+ }
+ }
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02, mac.size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+exit:
+ CRYPTO_FREE(mac);
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_MACComputeFinal*/
+static TEEC_Result Invoke_Crypto_MACComputeFinal(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length,
+ const void *full_data, const size_t fdata_length, uint32_t case_buf)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ /* Fill SharedMem1 with part_data */
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, fdata_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ /* Compute the MAC of $IN_fullDataValue$ and
+ compare it to "SharedMem2" */
+ if (res == TEEC_SUCCESS) {
+ struct crypto_buffer tmp_mac;
+ CRYPTO_INIT(tmp_mac);
+ ADBG_EXPECT_TEEC_SUCCESS(c, res =
+ mac_compute_final(c, s,
+ full_data,
+ fdata_length,
+ &tmp_mac));
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ ADBG_EXPECT_COMPARE_SIGNED(c, 0, ==,
+ memcmp(SHARE_MEM02->buffer,
+ tmp_mac.buffer,
+ op.params[3].memref.size));
+ CRYPTO_FREE(tmp_mac);
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_CipherInit*/
+static TEEC_Result Invoke_Crypto_CipherInit(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *iv, const size_t iv_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, iv_len,
+ TEEC_MEMREF_PARTIAL_INPUT, iv_len, iv)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Save the $IN_InitialisationVector$ for later
+ * computation of encryptedData
+ */
+ if (iv != NULL) {
+ CRYPTO_FREE(saved_cipher_iv);
+ saved_cipher_iv.size = iv_len;
+ saved_cipher_iv.buffer = malloc(iv_len);
+ memcpy(saved_cipher_iv.buffer, iv, iv_len);
+ }
+ }
+
+exit:
+ CRYPTO_FREE(saved_cipher_update);
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+
+ return res;
+}
+/*CMD_CipherUpdate*/
+static TEEC_Result Invoke_Crypto_CipherUpdate(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, uint32_t partd_length,
+ uint32_t case_buf)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, partd_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ /*if $IN_caseBuffer$ = OUTPUT_BUFFER_TOO_SHORT(2)
+ then Param[3].memref.size=1*/
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Save the buffer returned in "SharedMem2" in order
+ * to collapse all buffers returned for CipherUpdate,
+ * which will be used in CipherDoFinal
+ */
+ if (op.params[3].memref.size != 0) {
+ void *tmp = realloc(saved_cipher_update.buffer,
+ saved_cipher_update.size +
+ op.params[3].memref.size);
+ saved_cipher_update.buffer = tmp;
+ memcpy(
+ saved_cipher_update.buffer +
+ saved_cipher_update.size, SHARE_MEM02->buffer,
+ op.params[3].memref.size);
+ saved_cipher_update.size += op.params[3].memref.size;
+ }
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_CipherDoFinal*/
+static TEEC_Result Invoke_Crypto_CipherDoFinal(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph,
+ const void *part_data, const size_t partd_length,
+ const void *full_data, const size_t fulld_length, uint32_t case_buf)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ size_t initial_size;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, partd_length,
+ TEEC_MEMREF_PARTIAL_INPUT, partd_length,
+ part_data)
+ /* used fulld_length instead of partd_length as
+ described in the Adaptation layer specification.*/
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, fulld_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)*oph;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ /*if $IN_caseBuffer$ = OUTPUT_BUFFER_TOO_SHORT(2)
+ then Param[3].memref.size=1*/
+ if (case_buf == OUTPUT_BUFFER_TOO_SHORT) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02, 1)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+ initial_size = op.params[3].memref.size;
+
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ /* Append the buffer returned in "SharedMem2"
+ * to the previously buffers
+ * returned for CipherUpdate => "collapsed_buffers"
+ */
+ if (op.params[3].memref.size != 0) {
+ void *tmp = realloc(saved_cipher_update.buffer,
+ saved_cipher_update.size +
+ op.params[3].memref.size);
+ saved_cipher_update.buffer = tmp;
+ memcpy(
+ saved_cipher_update.buffer +
+ saved_cipher_update.size, SHARE_MEM02->buffer,
+ op.params[3].memref.size);
+ saved_cipher_update.size += op.params[3].memref.size;
+ }
+
+ /* Compute the ciphered data of
+ * $IN_fullDataValue$ and compare it
+ * to "collapsed_buffers"
+ */
+ struct crypto_buffer full_ciphered_data;
+ CRYPTO_INIT(full_ciphered_data);
+ ADBG_EXPECT_TEEC_SUCCESS(c, res =
+ cipher_do_final(c, s,
+ full_data,
+ fulld_length,
+ &
+ full_ciphered_data));
+
+ if (res == TEEC_SUCCESS) {
+ ADBG_EXPECT_BUFFER(c, full_ciphered_data.buffer,
+ full_ciphered_data.size,
+ saved_cipher_update.buffer,
+ saved_cipher_update.size);
+ } else if (res == TEEC_ERROR_SHORT_BUFFER) {
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, initial_size, <,
+ op.params[3].memref.size);
+ }
+
+ CRYPTO_FREE(full_ciphered_data);
+ CRYPTO_FREE(saved_cipher_update);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+/*CMD_FreeOperation*/
+static TEEC_Result Invoke_Crypto_FreeOperation(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const uint32_t cmd_id, TEE_OperationHandle *oph)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)*oph;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+ res = TEEC_InvokeCommand(s, cmd_id, &op, &ret_orig);
+
+ return res;
+}
+
+static TEEC_Result calculate_digest(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const void *data, const size_t data_length,
+ struct crypto_buffer *digest)
+{
+ TEEC_Result res = TEEC_ERROR_GENERIC;
+ TEE_OperationHandle op1 = (TEE_OperationHandle)3;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ res = Invoke_Crypto_AllocateOperation(c, s, CMD_AllocateOperation,
+ saved_alloc.algo, TEE_MODE_DIGEST,
+ saved_alloc.obj_size, 0, &op1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ /*CMD_DigestDoFinal*/
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM04, data_length,
+ TEEC_MEMREF_PARTIAL_INPUT, data_length,
+ data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM05, data_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)op1;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM04,
+ SHARE_MEM04->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM05,
+ SHARE_MEM05->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, CMD_DigestDoFinal, &op, &ret_orig);
+
+ if (SHARE_MEM05->size != 0 && res == TEEC_SUCCESS) {
+ digest->size = op.params[3].memref.size;
+ digest->buffer = malloc(op.params[3].memref.size);
+ memcpy(digest->buffer, SHARE_MEM05->buffer,
+ op.params[3].memref.size);
+ }
+
+exit:
+ Invoke_Crypto_FreeOperation(c, s, CMD_FreeOperation, &op1);
+ TEEC_ReleaseSharedMemory(SHARE_MEM04);
+ TEEC_ReleaseSharedMemory(SHARE_MEM05);
+ return res;
+}
+
+static TEEC_Result sign_digest(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const struct crypto_buffer *in_dgst, struct crypto_buffer *out_dgst)
+{
+ TEEC_Result res = TEEC_ERROR_GENERIC;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ TEE_OperationHandle op1 = (TEE_OperationHandle)3;
+ uint32_t ret_orig;
+
+ res = Invoke_Crypto_AllocateOperation(c, s, CMD_AllocateOperation,
+ saved_alloc.algo, TEE_MODE_SIGN,
+ saved_alloc.obj_size, 0, &op1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ if (saved_obh.obh2 != TEE_HANDLE_NULL) {
+ res = Invoke_Crypto_SetOperationKey2(c, s, CMD_SetOperationKey2,
+ &op1, &saved_obh.obh1,
+ &saved_obh.obh2);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ } else if (saved_obh.obh1 != TEE_HANDLE_NULL) {
+ res = Invoke_Crypto_SetOperationKey(c, s, CMD_SetOperationKey,
+ &op1, &saved_obh.obh1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ }
+
+ /*CMD_AsymmetricSignDigest*/
+ /* Fill SharedMem1 with the previously stored
+ Digest value after TEE_DigestDoFinal*/
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM04, 512,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ in_dgst->size, in_dgst->buffer)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM05, 512,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)op1;
+ if (in_dgst->size != 0) {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM04,
+ in_dgst->size)
+ } else {
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM04,
+ SHARE_MEM04->size)
+ }
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM05,
+ SHARE_MEM05->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, CMD_AsymmetricSignDigest, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ out_dgst->size = op.params[3].memref.size;
+ out_dgst->buffer = malloc(out_dgst->size);
+ memcpy(out_dgst->buffer, SHARE_MEM05->buffer, out_dgst->size);
+ }
+
+exit:
+ Invoke_Crypto_FreeOperation(c, s, CMD_FreeOperation, &op1);
+ TEEC_ReleaseSharedMemory(SHARE_MEM04);
+ TEEC_ReleaseSharedMemory(SHARE_MEM05);
+ return res;
+}
+
+static bool verify_digest(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const struct crypto_buffer *in_sdgst)
+{
+ TEEC_Result res;
+ bool is_valid = false;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ TEE_OperationHandle op1 = (TEE_OperationHandle)3;
+ uint32_t ret_orig;
+
+ res = Invoke_Crypto_AllocateOperation(c, s, CMD_AllocateOperation,
+ saved_alloc.algo, TEE_MODE_VERIFY,
+ saved_alloc.obj_size, 0, &op1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ if (saved_obh.obh2 != TEE_HANDLE_NULL) {
+ res = Invoke_Crypto_SetOperationKey2(c, s, CMD_SetOperationKey2,
+ &op1, &saved_obh.obh1,
+ &saved_obh.obh2);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ } else if (saved_obh.obh1 != TEE_HANDLE_NULL) {
+ res = Invoke_Crypto_SetOperationKey(c, s, CMD_SetOperationKey,
+ &op1, &saved_obh.obh1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ }
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM04, 512,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ saved_digest.size, saved_digest.buffer)
+ /* Fill "SharedMem2" with signature based on the previously
+ stored Digest value after TEE_DigestDoFinal */
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM05, 512,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ in_sdgst->size, in_sdgst->buffer)
+
+ op.params[0].value.a = (uint32_t)op1;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM04,
+ saved_digest.size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM05, in_sdgst->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_MEMREF_PARTIAL_INPUT);
+
+ res = TEEC_InvokeCommand(s, CMD_AsymmetricVerifyDigest, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS)
+ is_valid = true;
+
+exit:
+ Invoke_Crypto_FreeOperation(c, s, CMD_FreeOperation, &op1);
+ TEEC_ReleaseSharedMemory(SHARE_MEM04);
+ TEEC_ReleaseSharedMemory(SHARE_MEM05);
+ return is_valid;
+}
+
+static TEEC_Result mac_compute_final(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const void *full_data, const size_t fdata_length,
+ struct crypto_buffer *mac)
+{
+ TEEC_Result res = TEEC_ERROR_GENERIC;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ TEE_OperationHandle op1 = (TEE_OperationHandle)3;
+ uint32_t ret_orig;
+
+ res = Invoke_Crypto_AllocateOperation(c, s, CMD_AllocateOperation,
+ saved_alloc.algo, TEE_MODE_MAC,
+ saved_alloc.obj_size, 0, &op1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ if (saved_obh.obh2 != TEE_HANDLE_NULL) {
+ res = Invoke_Crypto_SetOperationKey2(c, s, CMD_SetOperationKey2,
+ &op1, &saved_obh.obh1,
+ &saved_obh.obh2);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ } else if (saved_obh.obh1 != TEE_HANDLE_NULL) {
+ res = Invoke_Crypto_SetOperationKey(c, s, CMD_SetOperationKey,
+ &op1, &saved_obh.obh1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+ }
+
+ res = Invoke_Crypto_MACInit(c, s, CMD_MACInit, &op1,
+ saved_mac_iv.buffer, saved_mac_iv.size);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ /* CMD_MACComputeFinal */
+ /* Fill SharedMem1 with full_data */
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM04, fdata_length,
+ TEEC_MEMREF_PARTIAL_INPUT, fdata_length,
+ full_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM05, fdata_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)op1;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM04,
+ SHARE_MEM04->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM05,
+ SHARE_MEM05->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, CMD_MACComputeFinal, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ mac->size = op.params[3].memref.size;
+ mac->buffer = malloc(mac->size);
+ memcpy(mac->buffer, SHARE_MEM05->buffer, mac->size);
+ }
+
+exit:
+ Invoke_Crypto_FreeOperation(c, s, CMD_FreeOperation, &op1);
+ TEEC_ReleaseSharedMemory(SHARE_MEM04);
+ TEEC_ReleaseSharedMemory(SHARE_MEM05);
+ return res;
+}
+
+static TEEC_Result cipher_do_final(
+ ADBG_Case_t *c, TEEC_Session *s,
+ const void *full_data, const size_t fdata_length,
+ struct crypto_buffer *cipher)
+{
+ TEEC_Result res = TEEC_ERROR_GENERIC;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ TEE_OperationHandle op1 = (TEE_OperationHandle)3;
+ uint32_t ret_orig;
+
+ res = Invoke_Crypto_AllocateOperation(c, s, CMD_AllocateOperation,
+ saved_alloc.algo,
+ TEE_MODE_ENCRYPT,
+ saved_alloc.obj_size, 0, &op1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ if (saved_obh.obh2 != TEE_HANDLE_NULL) {
+ res = Invoke_Crypto_SetOperationKey2(c, s, CMD_SetOperationKey2,
+ &op1, &saved_obh.obh1,
+ &saved_obh.obh2);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ } else if (saved_obh.obh1 != TEE_HANDLE_NULL) {
+ res = Invoke_Crypto_SetOperationKey(c, s, CMD_SetOperationKey,
+ &op1, &saved_obh.obh1);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ }
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM04, fdata_length,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ saved_cipher_iv.size,
+ saved_cipher_iv.buffer)
+
+ op.params[0].value.a = (uint32_t)op1;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM04,
+ saved_cipher_iv.size)
+
+ op.params[1].memref.offset = 0;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, CMD_CipherInit, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ TEEC_ReleaseSharedMemory(SHARE_MEM04);
+
+ /* CMD_CipherDoFinal */
+ /* Fill SharedMem1 with full_data */
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM04, fdata_length,
+ TEEC_MEMREF_PARTIAL_INPUT, fdata_length,
+ full_data)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM05, fdata_length,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = (uint32_t)op1;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM04,
+ SHARE_MEM04->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM05,
+ SHARE_MEM05->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_NONE, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, CMD_CipherDoFinal, &op, &ret_orig);
+
+ if (res == TEEC_SUCCESS) {
+ cipher->size = op.params[3].memref.size;
+ cipher->buffer = malloc(cipher->size);
+ memcpy(cipher->buffer, SHARE_MEM05->buffer, cipher->size);
+ }
+
+exit:
+ Invoke_Crypto_FreeOperation(c, s, CMD_FreeOperation, &op1);
+ TEEC_ReleaseSharedMemory(SHARE_MEM04);
+ TEEC_ReleaseSharedMemory(SHARE_MEM05);
+ return res;
+}
+
+#endif /* XML_CRYPTO_API_H_ */
diff --git a/host/xtest/xml/include/xml_datastorage_api.h b/host/xtest/xml/include/xml_datastorage_api.h
new file mode 100644
index 0000000..2039cfa
--- /dev/null
+++ b/host/xtest/xml/include/xml_datastorage_api.h
@@ -0,0 +1,1356 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef XML_DATASTORAGE_API_H_
+#define XML_DATASTORAGE_API_H_
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#ifdef USER_SPACE
+#include <pthread.h>
+#include <unistd.h>
+#endif
+
+#include "tee_client_api.h"
+#undef TA_UUID
+#include "TTA_DS_protocol.h"
+
+#define Invoke_FreeTransientObjectPanic Invoke_Simple_Function
+#define Invoke_RenamePersistentObject_Success Invoke_Simple_Function
+#define Invoke_CloseObjectPanic Invoke_Simple_Function
+#define Invoke_CreatePersistentObject_AccessConflict Invoke_Simple_Function
+#define Invoke_CloseFreeAndResetObjectSuccessHandleNull Invoke_Simple_Function
+#define Invoke_GetObjectInfoPanic Invoke_Simple_Function
+#define Invoke_OpenPersistentObject_Conflict Invoke_Simple_Function
+#define Invoke_FreeCloseAndDeletePersistentObjectSuccessHandleNull \
+ Invoke_Simple_Function
+#define Invoke_ResetPersistentObjectEnumeratorPanic Invoke_Simple_Function
+#define Invoke_GetNextPersistentObjectPanic Invoke_Simple_Function
+#define Invoke_RestrictObjectUsagePanic Invoke_Simple_Function
+#define Invoke_GetObjectValueAttributePanic Invoke_Simple_Function
+#define Invoke_FreePersistentObjectEnumeratorPanic Invoke_Simple_Function
+#define Invoke_StartPersistentObjectEnumeratorPanic Invoke_Simple_Function
+#define Invoke_ResetTransientObjectPanic Invoke_Simple_Function
+#define Invoke_RenamePersistentObject_AccessConflict Invoke_Simple_Function
+#define Invoke_OpenPersistentObjectPanic Invoke_Simple_Function
+#define Invoke_CreatePersistentObject_ItemNotFound Invoke_Simple_Function
+
+#define Invoke_CreatePersistentObject_Success Invoke_Simple_Function_SubTestCase
+#define Invoke_CreatePersistentObjectPanic Invoke_Simple_Function_SubTestCase
+#define Invoke_OpenPersistentObject_ItemNotFound \
+ Invoke_Simple_Function_SubTestCase
+#define Invoke_ReadObjectDataPanic Invoke_Simple_Function_SubTestCase
+#define Invoke_OpenPersistentObject_Success Invoke_Simple_Function_SubTestCase
+#define Invoke_RenamePersistentObjectPanic Invoke_Simple_Function_SubTestCase
+#define Invoke_TruncateObjectDataPanic Invoke_Simple_Function_SubTestCase
+#define Invoke_CloseAndDeletePersistentObjectPanic \
+ Invoke_Simple_Function_SubTestCase
+#define Invoke_SeekObjectDataPanic Invoke_Simple_Function_SubTestCase
+#define Invoke_WriteObjectDataPanic Invoke_Simple_Function_SubTestCase
+
+#define Invoke_AllocateTransientChain Invoke_Simple_Function_Object
+#define Invoke_GetBufferAttribute_object_uninitialized \
+ Invoke_Simple_Function_Object
+
+#define CLIENT_APP01 NULL
+
+#define TEEC_UNDEFINED_ERROR 0xDEADDEAD
+
+#define TEEC_ORIGIN_ANY_NOT_TRUSTED_APP 0x00000005
+
+#define OFFSET_0 0
+#define OFFSET_HIGH 900
+#define OFFSET_LOW 300
+
+#define INITIAL_DATA_SIZE 1024
+#define LARGER_THAN_INITIAL 1500
+#define SHORTER_THAN_INITIAL 500
+
+#define KEY_SIZE_TOO_LARGE 4096
+#define SIZE_AES_256 256
+#define SIZE_DES3_192 168
+#define SIZE_DES_64 56
+#define SIZE_DH_KEYPAIR_1024 1024
+#define SIZE_DSA_KEYPAIR_768 768
+#define SIZE_DSA_PUBLIC_KEY_768 768
+#define SIZE_GENERIC_SECRET_2048 2048
+#define SIZE_HMAC_MD5_256 256
+#define SIZE_HMAC_SHA1_256 256
+#define SIZE_HMAC_SHA224_256 256
+#define SIZE_HMAC_SHA256_512 512
+#define SIZE_HMAC_SHA384_512 512
+#define SIZE_HMAC_SHA512_512 512
+#define SIZE_RSA_KEYPAIR_2048 2048
+/* #define SIZE_RSA_PUBLIC_KEY_2048 2048 */
+#define SIZE_ZERO 0
+#define WRONG_SIZE 5
+
+#define TEE_ERROR_TOO_SHORT_BUFFER TEE_ERROR_SHORT_BUFFER
+
+#define TEE_ATTR_NONE (uint32_t)0
+
+#define NOMINAL_CASE 0
+
+#define BUFFER_ATTRIBUTE 0
+#define VALUE_ATTRIBUTE 1
+
+#ifdef USER_SPACE
+/* Test data defines */
+static pthread_t THREAD01_DEFAULT;
+#endif
+
+/* Return ORIGIN */
+static uint32_t ret_orig;
+
+static TEEC_SharedMemory *SHARE_MEM01;
+static TEEC_SharedMemory *SHARE_MEM02;
+static TEEC_SharedMemory *SHARE_MEM03;
+static TEEC_SharedMemory *SHARE_MEM04;
+static TEEC_Session *SESSION01;
+static TEEC_Session *SESSION02;
+static TEEC_Context *CONTEXT01;
+static TEEC_Context *CONTEXT02;
+static TEEC_Operation *OPERATION01;
+static TEEC_Operation *OPERATION02;
+
+static uint32_t BIG_SIZE = 1024;
+static uint32_t DS_BIG_SIZE = 16384;
+
+static uint8_t BUFFER01[] = {
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBB,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89, 0x5D, 0xAD, 0xF2, 0x9D, 0x62, 0xEF, 0x25,
+};
+
+static uint8_t TEE_ATTR_DES_64_VALUE01[] = {
+ 0xCD, 0xFE, 0x57, 0xB6, 0xB6, 0x2F, 0xAE, 0x6B,
+};
+
+static uint8_t TEE_ATTR_DH_BASE_VALUE01[] = {
+ 0x1c, 0xe0, 0xf6, 0x69, 0x26, 0x46, 0x11, 0x97, 0xef, 0x45, 0xc4, 0x65,
+ 0x8b, 0x83, 0xb8, 0xab,
+ 0x04, 0xa9, 0x22, 0x42, 0x68, 0x50, 0x4d, 0x05, 0xb8, 0x19, 0x83, 0x99,
+ 0xdd, 0x71, 0x37, 0x18,
+ 0xcc, 0x1f, 0x24, 0x5d, 0x47, 0x6c, 0xcf, 0x61, 0xa2, 0xf9, 0x34, 0x93,
+ 0xf4, 0x1f, 0x55, 0x52,
+ 0x48, 0x65, 0x57, 0xe6, 0xd4, 0xca, 0xa8, 0x00, 0xd6, 0xd0, 0xdb, 0x3c,
+ 0xbf, 0x5a, 0x95, 0x4b,
+ 0x20, 0x8a, 0x4e, 0xba, 0xf7, 0xe6, 0x49, 0xfb, 0x61, 0x24, 0xd8, 0xa2,
+ 0x1e, 0xf2, 0xf2, 0x2b,
+ 0xaa, 0xae, 0x29, 0x21, 0x10, 0x19, 0x10, 0x51, 0x46, 0x47, 0x31, 0xb6,
+ 0xcc, 0x3c, 0x93, 0xdc,
+ 0x6e, 0x80, 0xba, 0x16, 0x0b, 0x66, 0x64, 0xa5, 0x6c, 0xfa, 0x96, 0xea,
+ 0xf1, 0xb2, 0x83, 0x39,
+ 0x8e, 0xb4, 0x61, 0x64, 0xe5, 0xe9, 0x43, 0x84, 0xee, 0x02, 0x24, 0xe7,
+ 0x1f, 0x03, 0x7c, 0x23,
+};
+
+static uint8_t TEE_ATTR_DH_PRIME_VALUE01[] = {
+ 0xe0, 0x01, 0xe8, 0x96, 0x7d, 0xb4, 0x93, 0x53, 0xe1, 0x6f, 0x8e, 0x89,
+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63, 0xa3, 0xcf,
+ 0x9d, 0xef, 0x65, 0x61,
+ 0x27, 0x4d, 0x24, 0x01, 0xe7, 0xa1, 0x45, 0xf2, 0xd8, 0xb9, 0x3a, 0x45,
+ 0x17, 0xf4, 0x19, 0xd0,
+ 0x5e, 0xf8, 0xcb, 0x35, 0x59, 0x37, 0x9d, 0x04, 0x20, 0xa3, 0xbf, 0x02,
+ 0xad, 0xfe, 0xa8, 0x60,
+ 0xb2, 0xc3, 0xee, 0x85, 0x58, 0x90, 0xf3, 0xb5, 0x57, 0x2b, 0xb4, 0xef,
+ 0xd7, 0x8f, 0x37, 0x68,
+ 0x78, 0x7c, 0x71, 0x52, 0x9d, 0x5e, 0x0a, 0x61, 0x4f, 0x09, 0x89, 0x92,
+ 0x39, 0xf7, 0x4b, 0x01,
+};
+
+static uint8_t TEE_ATTR_DH_SUBPRIME_VALUE01[] = { 0 };
+/* static uint8_t *TEE_ATTR_DH_SUBPRIME_VALUE01=NULL; */
+
+static uint8_t TEE_ATTR_HMAC_MD5_256_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f,
+};
+
+static uint8_t TEE_ATTR_HMAC_SHA1_256_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f,
+};
+
+static uint8_t TEE_ATTR_HMAC_SHA224_256_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f,
+};
+
+static uint8_t TEE_ATTR_HMAC_SHA256_512_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
+ 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
+ 0x3c, 0x3d, 0x3e, 0x3f,
+};
+
+static uint8_t TEE_ATTR_HMAC_SHA384_512_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
+ 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
+ 0x3c, 0x3d, 0x3e, 0x3f,
+};
+
+static uint8_t TEE_ATTR_HMAC_SHA512_512_VALUE01[] = {
+ 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 0x8b, 0x83,
+};
+
+static uint8_t TEE_ATTR_DSA_PRIME_VALUE_WRONG01[] = {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x2b, 0x7e, 0x53, 0x26,
+ 0xda, 0x43, 0x9d, 0xc1,
+ 0x47, 0x4c, 0x1a, 0xd1, 0x6f, 0x2f, 0x85, 0xe9, 0x2c, 0xea, 0x89, 0xfc,
+ 0xdc, 0x74, 0x66, 0x11,
+ 0xcf, 0x30, 0xdd, 0xc8, 0x5e, 0x33, 0xf5, 0x83, 0xc1, 0x9d, 0x10, 0xbc,
+ 0x1a, 0xc3, 0x93, 0x22,
+ 0x26, 0x24, 0x6f, 0xa7, 0xb9, 0xe0, 0xdd, 0x25, 0x77, 0xb5, 0xf4, 0x27,
+ 0x59, 0x4c, 0x39, 0xfa,
+ 0xeb, 0xfc, 0x59, 0x8a, 0x32, 0xe1, 0x74, 0xcb, 0x8a, 0x68, 0x03, 0x57,
+ 0xf8, 0x62, 0xf2, 0x0b,
+ 0x6e, 0x84, 0x32, 0xa5, 0x30, 0x65, 0x2f, 0x1c, 0x21, 0x39, 0xae, 0x1f,
+ 0xaf, 0x76, 0x8b, 0x83,
+};
+
+static uint8_t TEE_ATTR_DSA_SUBPRIME_VALUE01[] = {
+ 0x87, 0x44, 0xe4, 0xdd, 0xc6, 0xd0, 0x19, 0xa5, 0xea, 0xc2, 0xb1, 0x5a,
+ 0x15, 0xd7, 0xe1, 0xc7,
+ 0xf6, 0x63, 0x35, 0xf7,
+};
+
+static uint8_t TEE_ATTR_GENERIC_SECRET_2048_VALUE01[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+ 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
+ 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0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c0,
+};
+
+static uint8_t TEE_ATTR_DSA_PUBLIC_VALUE_VALUE01[] = {
+ 0x52, 0x9d, 0xed, 0x98, 0xa2, 0x32, 0x09, 0x85, 0xfc, 0x84, 0xb6, 0x5a,
+ 0x9d, 0xc8, 0xd4, 0xfe,
+ 0x41, 0xad, 0xa6, 0xe3, 0x59, 0x3d, 0x70, 0x4f, 0x08, 0x98, 0xc1, 0x4e,
+ 0xc2, 0x46, 0x34, 0xdd,
+ 0xf5, 0xf1, 0xdb, 0x47, 0xcc, 0x49, 0x15, 0xfc, 0xe1, 0xe2, 0x67, 0x4d,
+ 0x2e, 0xcd, 0x98, 0xd5,
+ 0x8b, 0x59, 0x8e, 0x8d, 0xdf, 0xaf, 0xf3, 0x0e, 0x88, 0x26, 0xf5, 0x0a,
+ 0xab, 0x40, 0x27, 0xb5,
+ 0xaa, 0xb8, 0x87, 0xc1, 0x9a, 0xd9, 0x6d, 0x7e, 0x57, 0xde, 0x53, 0x90,
+ 0xad, 0x8e, 0x55, 0x57,
+ 0xb4, 0x1a, 0x80, 0x19, 0xc9, 0x0d, 0x80, 0x60, 0x71, 0x79, 0xb5, 0x4e,
+ 0xb0, 0xad, 0x4d, 0x23,
+};
+
+static const uint8_t *TEE_ATTR_VALUE_NONE;
+
+static uint32_t TEE_ATTR_RSA_PUBLIC_EXPONENT_VALUE01[] = { 0x10001 };
+
+/** ALL_TEEC_UUID
+ *
+ * These constants are the UUID of existing
+ * Trusted Applications
+ */
+/* "SMARTCSLTDATAST1" */
+static TEEC_UUID UUID_TTA_testingInternalAPI_dataStorage = {
+ 0x534D4152, 0x5443, 0x534C,
+ { 0x54, 0x44, 0x41, 0x54, 0x41, 0x53, 0x54, 0x31 }
+};
+
+/* Helper functions/macros */
+
+#define ALLOCATE_SHARED_MEMORY(context, sharedMemory, sharedMemorySize, \
+ memoryType) \
+ res = AllocateSharedMemory(context, sharedMemory, sharedMemorySize, \
+ memoryType); \
+ if (res != TEEC_SUCCESS) { \
+ goto exit; \
+ } \
+ memset(sharedMemory->buffer, 0, sharedMemorySize);
+
+#define ALLOCATE_AND_FILL_SHARED_MEMORY(context, sharedMemory, \
+ sharedMemorySize, \
+ memoryType, copySize, data) \
+ res = AllocateSharedMemory(context, sharedMemory, sharedMemorySize, \
+ memoryType); \
+ if (res != TEEC_SUCCESS) { \
+ goto exit; \
+ } \
+ if (data != NULL) { \
+ memcpy(sharedMemory->buffer, data, copySize); \
+ }
+
+#define SET_SHARED_MEMORY_OPERATION_PARAMETER(parameterNumber, \
+ sharedMemoryOffset, \
+ sharedMemory, \
+ sharedMemorySize) \
+ op.params[parameterNumber].memref.offset = sharedMemoryOffset; \
+ op.params[parameterNumber].memref.size = sharedMemorySize; \
+ op.params[parameterNumber].memref.parent = sharedMemory;
+
+/* XML_VERIFY macro define.
+ *
+ * Use ADBG_EXPECT or ADBG_EXPECT_NOT depending on the
+ * expected return value.
+ *
+ * ADBG_EXPECT() -> IF(EXP == GOT) RETURN TRUE
+ * ADBG_EXPECT() -> IF(EXP != GOT) RETURN TRUE
+ */
+#define XML_VERIFY(c, exp, got) \
+ do { \
+ if (exp == TEEC_UNDEFINED_ERROR) \
+ ADBG_EXPECT_NOT(c, exp, got); \
+ else \
+ ADBG_EXPECT(c, exp, got); \
+ } while (0)
+
+/* Initialize context using TEEC_InitializeContext and
+ check the returned value. */
+#define XML_InitializeContext(c, name, context, expected) \
+ XML_VERIFY(c, expected, TEEC_InitializeContext(name, context))
+
+/* Open session using TEEC_OpenSession and
+ check the returned value and/or returned origin. */
+#define XML_OpenSession(c, context, session, destination, connectionMethod, \
+ connectionData, operation, returnOrigin, expected) \
+ do { \
+ XML_VERIFY(c, expected, \
+ TEEC_OpenSession(context, session, destination, \
+ connectionMethod, connectionData, \
+ operation, &ret_orig)); \
+ if ((returnOrigin != 0) && \
+ ((int)returnOrigin != TEEC_ORIGIN_ANY_NOT_TRUSTED_APP)) \
+ ADBG_EXPECT(c, (int)returnOrigin, ret_orig); \
+ else \
+ ADBG_EXPECT_NOT(c, (int)returnOrigin, ret_orig); \
+ } while (0)
+
+/*dummy functions*/
+#define TEEC_SelectApp(a, b) /*do nothing for now*/
+
+/*Allocates TEEC_SharedMemory inside of the TEE*/
+static TEEC_Result AllocateSharedMemory(TEEC_Context *ctx,
+ TEEC_SharedMemory *shm, uint32_t size,
+ uint32_t flags)
+{
+ shm->flags = flags;
+ shm->size = size;
+ return TEEC_AllocateSharedMemory(ctx, shm);
+}
+
+/**
+ * Writes 4 byte to @p *data_pp and increases
+ * @p *data_pp by 4 byte. The bytes are written
+ * in Big Endian Order.
+ */
+static void put_uint32_be(void **data_pp, uint32_t v)
+{
+ uint8_t *d = *(uint8_t **)data_pp;
+ uint8_t *v_p = (uint8_t *)&v;
+
+ d[3] = v_p[0];
+ d[2] = v_p[1];
+ d[1] = v_p[2];
+ d[0] = v_p[3];
+ *(uint8_t **)data_pp += sizeof(uint32_t);
+}
+
+/**
+ * Reads 4 byte from the @p *data_pp
+ * as they are written in Big Endian Order.
+ */
+static uint32_t get_uint32_be(void **data_pp)
+{
+ const uint8_t *d = *(const uint8_t **)data_pp;
+
+ *(const uint8_t **)data_pp += sizeof(uint32_t);
+ return ((d[0] << 8 | d[1]) << 8 | d[2]) << 8 | d[3];
+}
+
+static TEEC_Result Invoke_Simple_Function(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_Simple_Function_SubTestCase(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t subTestCase)
+{
+ TEEC_Result res = TEEC_SUCCESS;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = subTestCase;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_Simple_Function_Object(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t objectType, uint32_t objectSize)
+{
+ TEEC_Result res = TEEC_SUCCESS;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = objectType;
+ op.params[0].value.b = objectSize;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_SeekWriteReadObjectData(
+ ADBG_Case_t *c, uint32_t cmdId, TEEC_Session *sess, TEE_Whence seekMode,
+ uint32_t offset, uint32_t initOffset)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint8_t *buf0 = NULL, *tmp = NULL;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ sizeof(BUFFER01), BUFFER01)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = seekMode;
+ op.params[0].value.b = offset;
+ op.params[1].value.a = initOffset;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ if (op.params[3].memref.size != op.params[2].memref.size) {
+ if (op.params[3].memref.size < op.params[2].memref.size) {
+ res = TEE_ERROR_SHORT_BUFFER;
+ goto exit;
+ }
+
+ tmp = (uint8_t *)op.params[3].memref.parent->buffer +
+ op.params[3].memref.size - sizeof(BUFFER01);
+ buf0 =
+ (uint8_t *)malloc(op.params[3].memref.size -
+ sizeof(BUFFER01));
+ memset(buf0, 0, op.params[3].memref.size - sizeof(BUFFER01));
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp, BUFFER01,
+ sizeof(BUFFER01)));
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(buf0,
+ op.params[3].memref.
+ parent->buffer,
+ (op.params[3].memref.
+ size -
+ sizeof(BUFFER01))));
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ free(buf0);
+ return res;
+}
+
+static TEEC_Result Invoke_InitObjectAndAttributes(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t subTestCase, uint32_t objectType, uint32_t objectSize,
+ uint32_t attributeId_1, const void *attribValue_1,
+ uint32_t attribSize_1,
+ uint32_t attributeId_2, const void *attribValue_2,
+ uint32_t attribSize_2,
+ uint32_t attributeId_3, const void *attribValue_3,
+ uint32_t attribSize_3,
+ uint32_t attributeId_4, const void *attribValue_4,
+ uint32_t attribSize_4,
+ uint32_t attributeId_5, const void *attribValue_5,
+ uint32_t attribSize_5)
+{
+ TEEC_Result res = TEEC_SUCCESS;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ void *tmp_buf1 = NULL;
+ uint8_t *tmp_buf2 = NULL;
+ uint32_t tmp_offset = 0;
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT)
+
+ tmp_buf1 = SHARE_MEM01->buffer;
+ tmp_buf2 = (uint8_t *)SHARE_MEM02->buffer;
+ put_uint32_be(&tmp_buf1, attributeId_1);
+
+ if (TEE_ATTR_NONE != attributeId_1) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_1);
+ memcpy(tmp_buf2, attribValue_1, (size_t)attribSize_1);
+ tmp_buf2 += attribSize_1;
+ tmp_offset += attribSize_1;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_2);
+
+ if (TEE_ATTR_NONE != attributeId_2) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_2);
+ memcpy(tmp_buf2, attribValue_2, (size_t)attribSize_2);
+ tmp_buf2 += attribSize_2;
+ tmp_offset += attribSize_2;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_3);
+
+ if (TEE_ATTR_NONE != attributeId_3) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_3);
+ memcpy(tmp_buf2, attribValue_3, (size_t)attribSize_3);
+ tmp_buf2 += attribSize_3;
+ tmp_offset += attribSize_3;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_4);
+
+ if (TEE_ATTR_NONE != attributeId_4) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_4);
+ memcpy(tmp_buf2, attribValue_4, (size_t)attribSize_4);
+ tmp_buf2 += attribSize_4;
+ tmp_offset += attribSize_4;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_5);
+
+ if (TEE_ATTR_NONE != attributeId_5) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_5);
+ memcpy(tmp_buf2, attribValue_5, (size_t)attribSize_5);
+ tmp_buf2 += attribSize_5;
+ tmp_offset += attribSize_5;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ op.params[0].value.a = objectType;
+ op.params[0].value.b = objectSize;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01, 60)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02, tmp_offset)
+ op.params[3].value.a = subTestCase;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_VALUE_INPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+static TEEC_Result Invoke_StartNGetPersistentObjectEnumerator_itemNotFound(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId)
+{
+ TEEC_Result res = TEEC_SUCCESS;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_OUTPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[0].value.a, ==, 0);
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[0].value.b, ==, 0);
+
+ return res;
+}
+
+static TEEC_Result Invoke_GetRSAAttributes(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t attributeType, uint32_t attributeId)
+{
+ TEEC_Result res = TEEC_SUCCESS;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ void *tmp_buf;
+ uint32_t tmp_int1;
+ uint32_t tmp_int2;
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM04, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INOUT)
+
+ tmp_buf = SHARE_MEM04->buffer;
+ put_uint32_be(&tmp_buf, attributeType);
+ put_uint32_be(&tmp_buf, attributeId);
+
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(0, 0, SHARE_MEM04,
+ SHARE_MEM04->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_MEMREF_PARTIAL_INOUT, TEEC_MEMREF_PARTIAL_OUTPUT,
+ TEEC_MEMREF_PARTIAL_OUTPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if ((res != TEEC_SUCCESS) || (VALUE_ATTRIBUTE == attributeType))
+ goto exit;
+
+ tmp_buf = SHARE_MEM04->buffer;
+ tmp_int1 = get_uint32_be(&tmp_buf);
+ tmp_int2 = TEE_ATTR_RSA_PRIME1;
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, tmp_int1, !=, tmp_int2);
+
+ tmp_buf = SHARE_MEM01->buffer;
+ tmp_int1 = get_uint32_be(&tmp_buf);
+ tmp_int2 = TEE_ATTR_RSA_PRIME2;
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, tmp_int1, !=, tmp_int2);
+
+ tmp_buf = SHARE_MEM02->buffer;
+ tmp_int1 = get_uint32_be(&tmp_buf);
+ tmp_int2 = TEE_ATTR_RSA_PRIVATE_EXPONENT;
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, tmp_int1, !=, tmp_int2);
+
+ tmp_buf = SHARE_MEM03->buffer;
+ tmp_int1 = get_uint32_be(&tmp_buf);
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, tmp_int1, !=, attributeId);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ TEEC_ReleaseSharedMemory(SHARE_MEM04);
+ return res;
+}
+
+static TEEC_Result Invoke_GenerateKey(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t subTestCase,
+ uint32_t objectType, uint32_t objectSize, uint32_t keySize,
+ uint32_t attributeId_1, const void *attribValue_1,
+ uint32_t attribSize_1,
+ uint32_t attributeId_2, const void *attribValue_2,
+ uint32_t attribSize_2,
+ uint32_t attributeId_3, const void *attribValue_3,
+ uint32_t attribSize_3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ void *tmp_buf1 = NULL;
+ uint8_t *tmp_buf2 = NULL;
+ int tmp_offset = 0;
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT)
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT)
+
+ tmp_buf1 = SHARE_MEM01->buffer;
+ tmp_buf2 = (uint8_t *)SHARE_MEM02->buffer;
+ put_uint32_be(&tmp_buf1, attributeId_1);
+
+ if (TEE_ATTR_NONE != attributeId_1) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_1);
+ memcpy(tmp_buf2, attribValue_1, (size_t)attribSize_1);
+ tmp_buf2 += attribSize_1;
+ tmp_offset += attribSize_1;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_2);
+
+ if (TEE_ATTR_NONE != attributeId_2) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_2);
+ memcpy(tmp_buf2, attribValue_2, (size_t)attribSize_2);
+ tmp_buf2 += attribSize_2;
+ tmp_offset += attribSize_2;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ put_uint32_be(&tmp_buf1, attributeId_3);
+
+ if (TEE_ATTR_NONE != attributeId_3) {
+ put_uint32_be(&tmp_buf1, tmp_offset);
+ put_uint32_be(&tmp_buf1, attribSize_3);
+ memcpy(tmp_buf2, attribValue_3, (size_t)attribSize_3);
+ tmp_buf2 += attribSize_3;
+ tmp_offset += attribSize_3;
+ } else {
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ put_uint32_be(&tmp_buf1, TEE_ATTR_NONE);
+ }
+
+ op.params[0].value.a = objectType;
+ op.params[0].value.b = objectSize;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01, 36)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02, tmp_offset)
+ op.params[3].value.a = subTestCase;
+ op.params[3].value.b = keySize;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_VALUE_INPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+static TEEC_Result Invoke_ReadObjectData(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t readSize, void *initialBuffer, uint32_t initialBufferSize)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = readSize;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (readSize <= initialBufferSize) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(SHARE_MEM01->buffer,
+ initialBuffer,
+ readSize));
+ } else {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(SHARE_MEM01->buffer,
+ initialBuffer,
+ initialBufferSize));
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_InitValueAttribute(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t attributeID)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = attributeID;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_GetDHAttributes(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t attributeType, uint32_t attributeId)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ sizeof(TEE_ATTR_DH_PRIME_VALUE01),
+ TEE_ATTR_DH_PRIME_VALUE01)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT,
+ sizeof(TEE_ATTR_DH_BASE_VALUE01),
+ TEE_ATTR_DH_BASE_VALUE01)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = attributeType;
+ op.params[0].value.b = attributeId;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ sizeof(TEE_ATTR_DH_PRIME_VALUE01))
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ sizeof(TEE_ATTR_DH_BASE_VALUE01))
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (VALUE_ATTRIBUTE == attributeType) {
+ /* Check if attributeId is coherent
+ with TEE_ATTR_DH_PRIME_VALUE01 and
+ TEE_ATTR_DH_BASE_VALUE01 */
+ } else if ((BUFFER_ATTRIBUTE == attributeType) ||
+ (res == TEEC_SUCCESS)) {
+ /* Check if attributeId (SHARE_MEM03) is coherent
+ with TEE_ATTR_DH_PRIME_VALUE01 and
+ TEE_ATTR_DH_BASE_VALUE01 */
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_EnumeratorOnPersistentObjects(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_OUTPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (res != TEEC_SUCCESS)
+ return res;
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ (op.params[0].value.b -
+ op.params[0].value.a), ==, 3);
+
+ return res;
+}
+
+static TEEC_Result Invoke_TruncateReadObjectData(
+ ADBG_Case_t *c, uint32_t cmdId, TEEC_Session *sess,
+ uint32_t numberOfBytes, uint32_t expectedReturn)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint8_t *buf0 = NULL;
+
+ if (numberOfBytes > INITIAL_DATA_SIZE) {
+ buf0 = (uint8_t *)malloc(numberOfBytes - INITIAL_DATA_SIZE);
+ memset(buf0, 0, numberOfBytes - INITIAL_DATA_SIZE);
+ }
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, DS_BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ op.params[0].value.a = numberOfBytes;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (!ADBG_EXPECT_COMPARE_SIGNED(c, res, ==, expectedReturn))
+ goto exit;
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, SHARE_MEM01->size, !=,
+ numberOfBytes);
+
+ if (numberOfBytes <= INITIAL_DATA_SIZE) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(SHARE_MEM01->buffer,
+ INITIAL_DATA,
+ numberOfBytes));
+ } else {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(SHARE_MEM01->buffer,
+ INITIAL_DATA,
+ INITIAL_DATA_SIZE));
+ uint8_t *tmp_buf = (uint8_t *)SHARE_MEM01->buffer +
+ INITIAL_DATA_SIZE;
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp_buf, buf0,
+ numberOfBytes -
+ INITIAL_DATA_SIZE));
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+
+ free(buf0);
+
+ return res;
+}
+
+#endif /* XML_DATASTORAGE_API_H_ */
diff --git a/host/xtest/xml/include/xml_internal_api.h b/host/xtest/xml/include/xml_internal_api.h
new file mode 100644
index 0000000..af2260c
--- /dev/null
+++ b/host/xtest/xml/include/xml_internal_api.h
@@ -0,0 +1,783 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef XML_INTERNAL_API_H_
+#define XML_INTERNAL_API_H_
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef USER_SPACE
+#include <pthread.h>
+#include <unistd.h>
+#endif
+
+#include <sys/types.h>
+#include "tee_client_api.h"
+#undef TA_UUID
+#include "TTA_TCF.h"
+
+
+#define Invoke_MaskUnmaskCancellations Invoke_Simple_Function
+#define Invoke_ProcessTAInvoke_Payload_Value Invoke_Simple_Function
+#define Invoke_ProcessTAInvoke_Payload_Value_In_Out Invoke_Simple_Function
+#define Invoke_ProcessTAInvoke_Payload_Memref Invoke_Simple_Function
+
+#define Invoke_GetPropertyAsBool_withoutEnum Invoke_GetPropertyAsXXX_withoutEnum
+#define Invoke_GetPropertyAsU32_withoutEnum Invoke_GetPropertyAsXXX_withoutEnum
+#define Invoke_GetPropertyAsUUID_withoutEnum Invoke_GetPropertyAsXXX_withoutEnum
+#define Invoke_GetPropertyAsIdentity_withoutEnum \
+ Invoke_GetPropertyAsXXX_withoutEnum
+#define Invoke_GetPropertyAsBinaryBlock_withoutEnum \
+ Invoke_GetPropertyAsXXX_withoutEnum
+#define Invoke_GetPropertyAsString_withoutEnum \
+ Invoke_GetPropertyAsXXX_withoutEnum
+
+#define Invoke_GetPropertyAsXXXX_fromEnum Invoke_StartPropertyEnumerator
+
+#define Invoke_FreePropertyEnumerator Invoke_ResetPropertyEnumerator
+#define Invoke_GetNextProperty_enumNotStarted Invoke_ResetPropertyEnumerator
+
+#define Invoke_ProcessTAInvoke_DeadErrorSuccess \
+ Invoke_ProcessInvokeTAOpenSession
+
+#define CLIENT_APP01 NULL
+
+#define TEEC_UNDEFINED_ERROR 0xDEADDEAD
+
+#define TEEC_ORIGIN_ANY_NOT_TRUSTED_APP 0x00000005
+/* same as TEE_ORIGIN_NOT_TRUSTED_APP */
+
+#define SIZE_ZERO 0
+
+#define TEE_ERROR_TOO_SHORT_BUFFER TEE_ERROR_SHORT_BUFFER
+
+#ifdef USER_SPACE
+/* Test data defines */
+static pthread_t THREAD01_DEFAULT;
+static pthread_t THREAD02;
+#endif
+
+static TEEC_SharedMemory *SHARE_MEM01;
+static TEEC_SharedMemory *SHARE_MEM02;
+static TEEC_Session *SESSION01;
+static TEEC_Session *SESSION02;
+/* Requires 2 sessions as we are opeing
+ multiple sessions at the same time */
+static TEEC_Context *CONTEXT01;
+static TEEC_Context *CONTEXT02;
+static TEEC_Operation *OPERATION01;
+
+/* Return ORIGIN */
+static uint32_t ret_orig;
+
+static uint32_t BIG_SIZE = 1024;
+
+char *NO_DATA;
+unsigned int ENUMERATOR1;
+
+#define ANY_OWNER_NOT_SET 0
+#define ANY_OWNER_SET_ACCESS_READ (TEE_MEMORY_ACCESS_ANY_OWNER | \
+ TEE_MEMORY_ACCESS_READ)
+#define ANY_OWNER_SET_ACCESS_WRITE (TEE_MEMORY_ACCESS_ANY_OWNER | \
+ TEE_MEMORY_ACCESS_WRITE)
+#define ANY_OWNER_SET_ACCESS_READ_WRITE (TEE_MEMORY_ACCESS_ANY_OWNER | \
+ TEE_MEMORY_ACCESS_READ | \
+ TEE_MEMORY_ACCESS_WRITE)
+
+#define SMALL_SIZE 0xA
+
+#define CMD_TEE_GetInstanceData 0x00000101
+#define CMD_TEE_SetInstanceData 0x00000102
+#define CMD_TEE_GetPropertyAsU32_withoutEnum 0x00000020
+
+#define NORMAL_SIZE_BUFFER 1
+#define TOO_SHORT_BUFFER 0
+#define CASE_NOT_NULL 1
+#define CASE_NULL 0
+#define CASE_BUFFER1_DIFFERS_FIRST 1
+#define CASE_BUFFER2_DIFFERS_FIRST 2
+#define CASE_EQUAL 0
+#define CASE_ERROR_ICA2 3
+#define CASE_PAYLOAD_VALUE 4
+#define CASE_SUCCESS_ICA2 2
+#define CASE_TARGET_DEAD_ICA2 1
+#define CASE_CANCEL_TIMEOUT 2
+#define CASE_ITEM_NOT_FOUND 3
+#define CASE_SUCCESS 0
+#define CASE_TARGET_BUSY 4
+#define CASE_TARGET_DEAD 1
+#define RESULT_EQUAL 0
+#define RESULT_INTEGER_GREATER_THAN_ZERO 1
+#define RESULT_INTEGER_LOWER_THAN_ZERO 2
+
+#define HINT_ZERO 0
+#define SIZE_OVER_MEMORY 0xFFFFFFFE
+
+#define TEE_ORIGIN_NOT_TRUSTED_APP 5
+/* same as TEEC_ORIGIN_ANY_NOT_TRUSTED_APP */
+#define TEE_PROPSET_IMPLEMENTATION TEE_PROPSET_TEE_IMPLEMENTATION
+
+static char VALUE_PREDEFINED_STRING[] = "this is a test string\0";
+static char VALUE_PREDEFINED_U32[] = "48059\0";
+static char VALUE_PREDEFINED_UUID[] = "534D4152-542D-4353-4C54-2D54412D3031\0";
+static char VALUE_PREDEFINED_IDENTITY[] =
+ "F0000000:534D4152-542D-4353-4C54-2D54412D3031\0";
+
+static char *VALUE_NONE;
+static char VALUE_PREDEFINED_BINARY_BLOCK[] =
+ "VGhpcyBpcyBhIHRleHQgYmluYXJ5IGJsb2Nr\0";
+static char VALUE_PREDEFINED_BOOLEAN[] = "true\0";
+
+static uint8_t CHAR1[] = { 0x10 };
+/* static uint8_t CHAR2[]={0xAA}; */
+
+static char GPD_CLIENT_identity[] = "gpd.client.identity\0";
+static char GPD_TA_appID[] = "gpd.ta.appID\0";
+static char GPD_TA_dataSize[] = "gpd.ta.dataSize\0";
+static char GPD_TA_instanceKeepAlive[] = "gpd.ta.instanceKeepAlive\0";
+static char GPD_TA_multiSession[] = "gpd.ta.multiSession\0";
+static char GPD_TA_singleInstance[] = "gpd.ta.singleInstance\0";
+static char GPD_TA_stackSize[] = "gpd.ta.stackSize\0";
+static char GPD_TEE_ARITH_maxBigIntSize[] = "gpd.tee.arith.maxBigIntSize\0";
+static char GPD_TEE_SYSTEM_TIME_protectionLevel[] =
+ "gpd.tee.systemTime.protectionLevel\0";
+static char GPD_TEE_TA_PERSISTENT_TIME_protectionLevel[] =
+ "gpd.tee.TAPersistentTime.protectionLevel\0";
+static char GPD_TEE_apiversion[] = "gpd.tee.apiversion\0";
+static char GPD_TEE_description[] = "gpd.tee.description\0";
+static char GPD_TEE_deviceID[] = "gpd.tee.deviceID\0";
+static char PROPERTY_NAME_NOT_VALID_ENCODING[] = "gpd.\t\n\r\0";
+static char PROPERTY_NAME_UNKNOWN[] = "unknown\0";
+static char SMC_TA_testuuid[] = "smc.ta.testuuid\0";
+static char SMC_TA_testbinaryblock[] = "smc.ta.testbinaryblock\0";
+static char SMC_TA_testbooltrue[] = "smc.ta.testbooltrue\0";
+static char SMC_TA_testidentity[] = "smc.ta.testidentity\0";
+static char SMC_TA_teststring[] = "smc.ta.teststring\0";
+static char SMC_TA_testu32[] = "smc.ta.testu32\0";
+static char STRING_SAMPLE_SIZE_4_CHAR[] = "TEE\0";
+
+
+/** ALL_TEEC_UUID
+ *
+ * These constants are the UUID of existing
+ * Trusted Applications
+ */
+/* "SMART-CSLT-TA-01" */
+static TEEC_UUID UUID_TTA_testingInternalAPI_TrustedCoreFramework = {
+ 0x534D4152, 0x542D, 0x4353,
+ { 0x4C, 0x54, 0x2D, 0x54, 0x41, 0x2D, 0x30, 0x31 }
+};
+/* "SMARTCSLTATCFICA" */
+/* Changed endians from the adaptation layer specification description */
+static TEEC_UUID UUID_TTA_testingInternalAPI_TrustedCoreFramework_ICA = {
+ 0x52414D53, 0x4354, 0x4C53,
+ { 0x54, 0x41, 0x54, 0x43, 0x46, 0x49, 0x43, 0x41 }
+};
+/* "SMARTCSLTTCFICA2" */
+/* Changed endians from the adaptation layer specification description */
+static TEEC_UUID UUID_TTA_testingInternalAPI_TrustedCoreFramework_ICA2 = {
+ 0x52414D53, 0x4354, 0x4C53,
+ { 0x54, 0x54, 0x43, 0x46, 0x49, 0x43, 0x41, 0x32 }
+};
+/* "SMARTCSLMLTINSTC" */
+static TEEC_UUID
+ UUID_TTA_testingInternalAPI_TrustedCoreFramework_MultipleInstanceTA = {
+ 0x534D4152, 0x5443, 0x534C,
+ { 0x4D, 0x4C, 0x54, 0x49, 0x4E, 0x53, 0x54, 0x43 }
+};
+/* "SMARTCSLSGLINSTC" */
+static TEEC_UUID
+ UUID_TTA_testingInternalAPI_TrustedCoreFramework_SingleInstanceTA = {
+ 0x534D4152, 0x5443, 0x534C,
+ { 0x53, 0x47, 0x4C, 0x49, 0x4E, 0x53, 0x54, 0x43 }
+};
+/* "SMART-CUNK-NO-WN" */
+static TEEC_UUID UUID_Unknown = {
+ 0x534D4152, 0x542D, 0x4355,
+ { 0x4E, 0x4B, 0x2D, 0x4E, 0x4F, 0x2D, 0x57, 0x4E }
+};
+
+
+/* Helper functions/macros */
+
+#define IDENTIFIER_NOT_USED(x) { if (sizeof(&x)) {} }
+
+#define ALLOCATE_SHARED_MEMORY(context, sharedMemory, \
+ sharedMemorySize, \
+ memoryType) \
+ res = AllocateSharedMemory(context, sharedMemory, \
+ sharedMemorySize, \
+ memoryType); \
+ if (res != TEEC_SUCCESS) { \
+ goto exit; \
+ } \
+ memset(sharedMemory->buffer, 0, sharedMemorySize);
+
+#define ALLOCATE_AND_FILL_SHARED_MEMORY(context, sharedMemory, \
+ sharedMemorySize, \
+ memoryType, copySize, data) \
+ res = AllocateSharedMemory(context, sharedMemory, sharedMemorySize, \
+ memoryType); \
+ if (res != TEEC_SUCCESS) { \
+ goto exit; \
+ } \
+ if (data != NULL) { \
+ memcpy(sharedMemory->buffer, data, copySize); \
+ }
+
+#define SET_SHARED_MEMORY_OPERATION_PARAMETER(parameterNumber, \
+ sharedMemoryOffset, \
+ sharedMemory, \
+ sharedMemorySize) \
+ op.params[parameterNumber].memref.offset = sharedMemoryOffset; \
+ op.params[parameterNumber].memref.size = sharedMemorySize; \
+ op.params[parameterNumber].memref.parent = sharedMemory;
+
+/* XML_VERIFY macro define.
+ *
+ * Use ADBG_EXPECT or ADBG_EXPECT_NOT depending on the expected return value.
+ *
+ * ADBG_EXPECT() -> IF(EXP == GOT) RETURN TRUE
+ * ADBG_EXPECT() -> IF(EXP != GOT) RETURN TRUE
+ */
+#define XML_VERIFY(c, exp, got) \
+ do { \
+ if (exp == TEEC_UNDEFINED_ERROR) \
+ ADBG_EXPECT_NOT(c, exp, got); \
+ else \
+ ADBG_EXPECT(c, exp, got); \
+ } while (0)
+
+/* Initialize context using TEEC_InitializeContext and
+ check the returned value. */
+#define XML_InitializeContext(c, name, context, expected) \
+ XML_VERIFY(c, expected, TEEC_InitializeContext(name, context))
+
+/*Open session using TEEC_OpenSession and check
+ the returned value and/or returned origin.*/
+#define XML_OpenSession(c, context, session, destination, connectionMethod, \
+ connectionData, operation, returnOrigin, expected) \
+ do { \
+ XML_VERIFY(c, expected, \
+ TEEC_OpenSession(context, session, destination, \
+ connectionMethod, connectionData, \
+ operation, &ret_orig)); \
+ if ((returnOrigin != 0) && \
+ ((int)returnOrigin != TEEC_ORIGIN_ANY_NOT_TRUSTED_APP)) \
+ ADBG_EXPECT(c, (int)returnOrigin, ret_orig); \
+ else \
+ ADBG_EXPECT_NOT(c, (int)returnOrigin, ret_orig); \
+ } while (0)
+
+#define OPERATION_TEEC_PARAM_TYPES(op, p0, p1, p2, p3) \
+ op->paramTypes = TEEC_PARAM_TYPES(p0, p1, p2, p3)
+
+/*dummy functions*/
+#define TEEC_SelectApp(a, b) /* do nothing for now */
+#define TEEC_createThread(a, b) /* do nothing for now */
+
+#ifdef USER_SPACE
+static void *cancellation_thread(void *arg)
+{
+ TEEC_RequestCancellation((TEEC_Operation *)arg);
+ return NULL;
+}
+#endif
+
+#ifdef USER_SPACE
+#define RequestCancellation(op) \
+ (void)ADBG_EXPECT(c, 0, \
+ pthread_create(&THREAD02, NULL, cancellation_thread, \
+ (void *)op)); \
+ (void)ADBG_EXPECT(c, 0, pthread_join(THREAD02, NULL));
+#else
+#define RequestCancellation(op) \
+ IDENTIFIER_NOT_USED(op)
+#endif
+
+/* Allocates TEEC_SharedMemory inside of the TEE */
+static TEEC_Result AllocateSharedMemory(TEEC_Context *ctx,
+ TEEC_SharedMemory *shm, uint32_t size,
+ uint32_t flags)
+{
+ shm->flags = flags;
+ shm->size = size;
+ return TEEC_AllocateSharedMemory(ctx, shm);
+}
+
+static TEEC_Result Invoke_Simple_Function(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_MemFill(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t memoryFillSize, uint8_t *charFill)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = memoryFillSize;
+ op.params[1].value.a = *charFill;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_GetPropertyAsXXX_withoutEnum(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ TEE_PropSetHandle propSet, char *name, uint32_t kindBuffer,
+ char *expectedValue)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t nameLen = 0;
+ uint32_t expectedValueLen = 0;
+
+ nameLen = strlen(name) + 1;
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT, nameLen,
+ name)
+
+ if (kindBuffer == TOO_SHORT_BUFFER) {
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, 1,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ } else {
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ }
+
+ op.params[0].value.a = (uint32_t)propSet;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01, nameLen)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_OUTPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ if (expectedValue != VALUE_NONE) {
+ expectedValueLen = strlen(expectedValue) + 1;
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(op.params[2].memref.
+ parent->buffer,
+ expectedValue,
+ expectedValueLen));
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+static TEEC_Result Invoke_MemCompare(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t memorySize, uint32_t Case, uint32_t compareResult)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t outValue = 0;
+
+ op.params[0].value.a = memorySize;
+ op.params[1].value.a = Case;
+ op.params[2].value.a = outValue;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_VALUE_INPUT, TEEC_VALUE_OUTPUT,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ if (compareResult == RESULT_EQUAL) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[2].value.a, ==,
+ 0);
+ } else if (compareResult == RESULT_INTEGER_GREATER_THAN_ZERO) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ (int32_t)op.params[2].value.a,
+ >, 0);
+ } else if (compareResult == RESULT_INTEGER_LOWER_THAN_ZERO) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ (int32_t)op.params[2].value.a,
+ <, 0);
+ }
+
+exit:
+ return res;
+}
+
+static TEEC_Result Invoke_SetInstanceData(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, char *data)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT, sizeof(data),
+ data)
+
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(0, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_GetInstanceData(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, char *expectedData,
+ uint32_t expectedDataSize)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(0, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_MEMREF_PARTIAL_OUTPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ if (res != TEE_ERROR_GENERIC) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[0].memref.size,
+ ==, expectedDataSize);
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(SHARE_MEM01->buffer,
+ expectedData,
+ expectedDataSize));
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_ProcessInvokeTAOpenSession(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t TACmd, TEEC_UUID *UUID, uint32_t returnOrigin)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_INPUT, 16, UUID)
+
+ op.params[0].value.a = TACmd;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01, 16)
+ op.params[2].value.a = returnOrigin;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT, TEEC_VALUE_OUTPUT,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (TEE_ORIGIN_NOT_TRUSTED_APP == returnOrigin) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[2].value.a, !=,
+ TEE_ORIGIN_TRUSTED_APP);
+ } else {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[2].value.a, ==,
+ returnOrigin);
+ }
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_CheckMemoryAccessRight(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t memoryParamType, uint32_t memoryAccessFlags)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ memoryParamType)
+
+ op.params[0].value.a = memoryAccessFlags;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, memoryParamType, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_MemMove(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, uint32_t memorySize)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = memorySize;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_AllocatePropertyEnumerator(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t *enumerator)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = 0;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_OUTPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ *enumerator = op.params[0].value.a;
+ /* (void)ADBG_EXPECT_COMPARE_SIGNED(
+ c, op.params[0].value.a, == , enumerator); */
+
+exit:
+ return res;
+}
+
+static TEEC_Result Invoke_StartPropertyEnumerator(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, uint32_t enumerator,
+ TEE_PropSetHandle propSet)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = enumerator;
+ op.params[1].value.a = (uint32_t)propSet;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_ResetPropertyEnumerator(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, uint32_t enumerator)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = enumerator;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_GetPropertyName(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t enumerator, char *propertyName, uint32_t kindBuffer)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t strLen = 0;
+
+ if (kindBuffer == TOO_SHORT_BUFFER) {
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, 1,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ } else {
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+ }
+
+ op.params[0].value.a = enumerator;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ strLen = strlen(propertyName) + 1;
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[1].memref.size, ==,
+ strLen);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(SHARE_MEM01->buffer,
+ propertyName, strLen));
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_Malloc(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t memorySize, uint32_t hint)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = memorySize;
+ op.params[1].value.a = hint;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_Panic(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ if (res != TEEC_SUCCESS)
+ goto exit;
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, org, ==, TEE_ORIGIN_TEE);
+
+exit:
+ return res;
+}
+
+static TEEC_Result Invoke_Realloc(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t oldMemorySize, uint32_t newMemorySize)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = oldMemorySize;
+ op.params[1].value.a = newMemorySize;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_Free(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, uint32_t Case)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = Case;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_GetCancellationFlag_RequestedCancel(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ TEEC_Operation *operation)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+#endif /* XML_INTERNAL_API_H_ */
diff --git a/host/xtest/xml/include/xml_timearithm_api.h b/host/xtest/xml/include/xml_timearithm_api.h
new file mode 100644
index 0000000..cae9d33
--- /dev/null
+++ b/host/xtest/xml/include/xml_timearithm_api.h
@@ -0,0 +1,1858 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef XML_TIMEARITHM_API_H_
+#define XML_TIMEARITHM_API_H_
+
+#include <openssl/bn.h>
+
+#define Invoke_GetSystemTime Invoke_Simple_Function
+#define Invoke_GetREETime Invoke_Simple_Function
+#define Invoke_SetTAPersistentTime_and_GetTAPersistentTime_Overflow \
+ Invoke_Simple_Function
+#define Invoke_SetTAPersistentTime_and_GetTAPersistentTime \
+ Invoke_Simple_Function
+#define Invoke_BigIntConvertToOctetStringOverflow Invoke_Simple_Function
+#define Invoke_BigIntConvertFromOctetStringOverflow Invoke_Simple_Function
+#define Invoke_GetTAPersistentTime_NotSet_and_SetTAPersistentTime \
+ Invoke_Simple_Function
+#define Test_Tool_Erase_Persistent_Time Invoke_Simple_Function
+
+#define Invoke_BigIntMod Invoke_BigIntDiv_Remain
+
+#define Invoke_BigIntSquareMod Invoke_BigIntMulMod
+
+static TEEC_SharedMemory *SHARE_MEM01;
+static TEEC_SharedMemory *SHARE_MEM02;
+static TEEC_SharedMemory *SHARE_MEM03;
+static TEEC_Session *SESSION01;
+static TEEC_Context *CONTEXT01;
+static TEEC_Context *CONTEXT02;
+static TEEC_Operation *OPERATION01;
+
+#define CMD_TEE_SetTAPersistentTime_and_GetTAPersistentTime_Overflow \
+ CMD_TEE_SetTAPersistentTime_and_GetTAPersistentTimeOverflow
+
+#define CLIENT_APP01 NULL
+
+#define TEEC_UNDEFINED_ERROR 0xDEADDEAD
+
+#define TEEC_ORIGIN_ANY_NOT_TRUSTED_APP 0x00000005
+/* same as TEE_ORIGIN_NOT_TRUSTED_APP */
+
+/* Return ORIGIN */
+static uint32_t ret_orig;
+
+#ifdef USER_SPACE
+/*Test data defines*/
+static pthread_t THREAD01_DEFAULT;
+static pthread_t THREAD02;
+#endif
+
+#define BIT0_MASK 1
+#define BIT1_MASK 2
+#define BIT2_MASK 4
+
+#define NEGATIVE 0
+#define POSITIVE 1
+
+#define RESULT_NOT_A_PRIME 0
+#define RESULT_PRIME 1
+
+#define RESULT_EQUAL 0
+#define RESULT_INTEGER_GREATER_THAN_ZERO 1
+#define RESULT_INTEGER_LOWER_THAN_ZERO 2
+
+#define CASE_WAIT_CANCELLED 1
+#define CASE_WAIT_SUCCESS 2
+
+static uint32_t CONFIDENCE_LEVEL_80 = 80;
+
+static uint8_t BIG_VALUE1_SIZE_64_BITS[] = {
+ 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+};
+
+
+static uint8_t BIG_VALUE2_SIZE_64_BITS[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static uint8_t BIG_VALUE3_SIZE_32_BITS[] = {
+ 0x0F, 0xFF, 0xFF, 0xFF,
+};
+
+static uint8_t BIG_VALUE4_SIZE_32_BITS[] = {
+ 0x01, 0x00, 0x00, 0x00,
+};
+
+static uint8_t BIG_VALUE5_SIZE_2048_BITS[] = {
+ 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF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xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+};
+
+static uint8_t BIG_VALUE6_SIZE_2048_BITS[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x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F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+};
+
+static uint8_t BIG_VALUE10_SIZE_32_BITS_PRIME_WITH_VALUE3[] = {
+ 0x0E, 0xFF, 0xFF, 0xFF,
+};
+
+static uint8_t BIG_VALUE13_SIZE_32_BITS_PRIME[] = {
+ 0x00, 0x00, 0x0D, 0x69,
+};
+
+static uint8_t BIG_VALUE14_SIZE_32_BITS_NOT_PRIME[] = {
+ 0x00, 0x00, 0x0D, 0x68,
+};
+
+static uint8_t BIG_VALUE15_SIZE_32_BITS[] = {
+ 0x00, 0x00, 0x00, 0x03,
+};
+
+static uint8_t BIG_VALUE16_SIZE_64_BITS[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+};
+
+static uint8_t BIG_VALUE17_SIZE_1024_BITS[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x03,
+};
+
+static uint8_t BIG_VALUE18_SIZE_2048_BITS[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x03,
+};
+
+static uint8_t BIG_VALUE19_SIZE_32_BITS_PRIME_WITH_VALUE_3[] = {
+ 0x00, 0x00, 0x00, 0x04,
+};
+
+static uint8_t BIG_VALUE20_SIZE_2048_BITS_PRIME_WITH_VALUE5[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04,
+};
+
+static uint8_t BIG_VALUE_ONE_SIZE_64_BITS[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+};
+
+static uint8_t BIG_VALUE_ZERO_SIZE_32_BITS[] = {
+ 0x00, 0x00, 0x00, 0x00,
+};
+
+static uint8_t BIG_VALUE_ZERO_SIZE_64_BITS[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static uint8_t BIG_VALUE_ZERO_SIZE_2048_BITS[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+};
+
+static uint8_t VALUE1_32_BITS[] = {
+ 0x01, 0x23, 0x45, 0x67,
+};
+
+
+/** ALL_TEEC_UUID
+ *
+ * These constants are the UUID of existing
+ * Trusted Applications
+ */
+/* "SMARTCLSARITHMET" */
+static TEEC_UUID UUID_TTA_testingInternalAPI_Arithmetique = {
+ 0x534D4152, 0x5443, 0x4C53,
+ { 0x41, 0x52, 0x49, 0x54, 0x48, 0x4D, 0x45, 0x54 }
+};
+/* "SMARTCSL_TIMEAPI" */
+static TEEC_UUID UUID_TTA_testingInternalAPI_Time = {
+ 0x534D4152, 0x5443, 0x534C,
+ { 0x5F, 0x54, 0x49, 0x4D, 0x45, 0x41, 0x50, 0x49 }
+};
+
+/*Helper functions/macros*/
+#define IDENTIFIER_NOT_USED(x) { if (sizeof(&x)) {} }
+
+#define ALLOCATE_SHARED_MEMORY(context, sharedMemory, sharedMemorySize, \
+ memoryType) \
+ res = AllocateSharedMemory(context, sharedMemory, sharedMemorySize, \
+ memoryType); \
+ if (res != TEEC_SUCCESS) { \
+ goto exit; \
+ } \
+ memset(sharedMemory->buffer, 0, sharedMemorySize);
+
+#define ALLOCATE_AND_FILL_SHARED_MEMORY(context, sharedMemory, \
+ sharedMemorySize, \
+ memoryType, data) \
+ res = AllocateSharedMemory(context, sharedMemory, sharedMemorySize, \
+ memoryType); \
+ if (res != TEEC_SUCCESS) { \
+ goto exit; \
+ } \
+ if (data != NULL) { \
+ memcpy(sharedMemory->buffer, data, sharedMemorySize); \
+ }
+
+#define SET_SHARED_MEMORY_OPERATION_PARAMETER(parameterNumber, \
+ sharedMemoryOffset, \
+ sharedMemory, \
+ sharedMemorySize) \
+ op.params[parameterNumber].memref.offset = sharedMemoryOffset; \
+ op.params[parameterNumber].memref.size = sharedMemorySize; \
+ op.params[parameterNumber].memref.parent = sharedMemory;
+
+#define BN_DECLARE_AND_INIT() \
+ BN_CTX *ctx = NULL; \
+ BIGNUM *a = NULL, *b = NULL, *s = NULL, *d = NULL, \
+ *m = NULL, *l = NULL, \
+ *r = NULL; \
+ ctx = BN_CTX_new(); \
+ if (ctx == NULL) { \
+ goto exit; \
+ } \
+ a = BN_new(); \
+ b = BN_new(); \
+ s = BN_new(); \
+ d = BN_new(); \
+ m = BN_new(); \
+ l = BN_new(); \
+ r = BN_new();
+
+#define BN_FREE() \
+ BN_free(a); \
+ BN_free(b); \
+ BN_free(s); \
+ BN_free(d); \
+ BN_free(m); \
+ BN_free(l); \
+ BN_free(r); \
+ if (ctx) { \
+ BN_CTX_free(ctx); \
+ }
+
+/* XML_VERIFY macro define.
+ *
+ * Use ADBG_EXPECT or ADBG_EXPECT_NOT depending on the expected return value.
+ *
+ * ADBG_EXPECT() -> IF(EXP == GOT) RETURN TRUE
+ * ADBG_EXPECT() -> IF(EXP != GOT) RETURN TRUE
+ */
+#define XML_VERIFY(c, exp, got) \
+ do { \
+ if (exp == TEEC_UNDEFINED_ERROR) \
+ ADBG_EXPECT_NOT(c, exp, got); \
+ else \
+ ADBG_EXPECT(c, exp, got); \
+ } while (0)
+
+/* Initialize context using TEEC_InitializeContext and
+ check the returned value. */
+#define XML_InitializeContext(c, name, context, expected) \
+ XML_VERIFY(c, expected, TEEC_InitializeContext(name, context))
+
+/* Open session using TEEC_OpenSession and
+ check the returned value and/or returned origin. */
+#define XML_OpenSession(c, context, session, destination, connectionMethod, \
+ connectionData, operation, returnOrigin, expected) \
+ do { \
+ XML_VERIFY(c, expected, \
+ TEEC_OpenSession(context, session, destination, \
+ connectionMethod, connectionData, \
+ operation, &ret_orig)); \
+ if ((returnOrigin != 0) && \
+ ((int)returnOrigin != TEEC_ORIGIN_ANY_NOT_TRUSTED_APP)) \
+ ADBG_EXPECT(c, (int)returnOrigin, ret_orig); \
+ else \
+ ADBG_EXPECT_NOT(c, (int)returnOrigin, ret_orig); \
+ } while (0)
+
+#define OPERATION_TEEC_PARAM_TYPES(op, p0, p1, p2, p3) \
+ do { \
+ op->paramTypes = TEEC_PARAM_TYPES(p0, p1, p2, p3); \
+ } while (0)
+
+
+/*dummy functions*/
+#define TEEC_SelectApp(a, b) /*do nothing for now*/
+#define TEEC_createThread(a, b) /*do nothing for now*/
+
+#ifdef USER_SPACE
+static void *cancellation_thread(void *arg)
+{
+ TEEC_RequestCancellation((TEEC_Operation *)arg);
+ return NULL;
+}
+#endif
+
+#ifdef USER_SPACE
+#define RequestCancellation(op) \
+ (void)ADBG_EXPECT(c, 0, \
+ pthread_create(&THREAD02, NULL, cancellation_thread, \
+ (void *)op)); \
+ (void)ADBG_EXPECT(c, 0, pthread_join(THREAD02, NULL));
+#else
+#define RequestCancellation(op) \
+ IDENTIFIER_NOT_USED(op)
+#endif
+
+/*Allocates TEEC_SharedMemory inside of the TEE*/
+static TEEC_Result AllocateSharedMemory(TEEC_Context *ctx,
+ TEEC_SharedMemory *shm, uint32_t size,
+ uint32_t flags)
+{
+ shm->flags = flags;
+ shm->size = size;
+ return TEEC_AllocateSharedMemory(ctx, shm);
+}
+
+static TEEC_Result Invoke_Simple_Function(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntCmpS32(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t expectedComparisonResult)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ op.params[3].value.a = expectedComparisonResult;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_VALUE_INPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntShiftRight(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint32_t bits)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0, sign_cmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM02, ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+
+ op.params[0].value.a = tmp;
+ op.params[0].value.b = (uint32_t)bits;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_OUTPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM02->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM02->size);
+
+ if (!BN_bin2bn(SHARE_MEM01->buffer, SHARE_MEM01->size, a))
+ goto exit;
+
+ if (!BN_rshift(b, a, (int)bits))
+ goto exit;
+
+ BN_bn2bin(b, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM02->buffer,
+ SHARE_MEM02->size));
+
+ tmp = op.params[0].value.b;
+ if (tmp & BIT0_MASK)
+ sign_cmp = POSITIVE;
+ else
+ sign_cmp = NEGATIVE;
+
+ /* This is not implemented according to the Adaptation layer
+ * specification document.
+ * In case when the number of bits to be shifted right is equal
+ * or bigger then the actual size of the buffer,
+ * the returned buffer (big number) will be zero and the returned
+ * sign will be positive, so the returned
+ * sign check should be performed against the POSITIVE sign
+ * instead of the original (input) number sign.
+ */
+ if (size_N1 > bits) {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, sign_cmp, ==, sign1);
+ } else {
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, sign_cmp, ==,
+ (uint32_t)POSITIVE);
+ }
+
+exit:
+ BN_FREE()
+ free(tmp1);
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntDiv_Remain(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_div(d, m, a, b, ctx))
+ goto exit;
+
+ BN_bn2bin(m, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntDiv_Quotient(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_div(d, m, a, b, ctx))
+ goto exit;
+
+ BN_bn2bin(d, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntAdd(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_add(d, a, b))
+ goto exit;
+
+ BN_bn2bin(d, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntIsProbablePrime(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t confidenceLevel, uint32_t expectedProbabilityResult)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+
+ op.params[0].value.a = tmp;
+ op.params[0].value.b = confidenceLevel;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ op.params[3].value.a = expectedProbabilityResult;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_VALUE_INPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntConvert_and_ComputeFMM(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3, uint32_t sign3, uint8_t *value3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM03,
+ ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value3)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+ if (sign3)
+ tmp = tmp | BIT2_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_INPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntAddMod(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+ if (res != TEE_SUCCESS)
+ goto exit;
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_add(s, a, a))
+ goto exit;
+
+ if (!BN_div(d, m, s, b, ctx))
+ goto exit;
+
+ BN_bn2bin(m, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntSubMod(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+ if (res != TEE_SUCCESS)
+ goto exit;
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_sub(s, a, a))
+ goto exit;
+
+ if (!BN_div(d, m, s, b, ctx))
+ goto exit;
+
+ BN_bn2bin(m, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntGetBit(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t BitIndex, bool expectedBooleanResult)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+
+ op.params[0].value.a = tmp;
+ op.params[0].value.b = BitIndex;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_VALUE_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[3].value.a, ==,
+ expectedBooleanResult);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntMulMod(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+ if (res != TEE_SUCCESS)
+ goto exit;
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_sqr(s, a, ctx))
+ goto exit;
+
+ if (!BN_div(d, m, s, b, ctx))
+ goto exit;
+
+ BN_bn2bin(m, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_Wait(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, uint32_t Case)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = Case;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntComputeExtendedGcd(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntGetBitCount(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t ExpectedBitCount)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_VALUE_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c, op.params[3].value.a, ==,
+ ExpectedBitCount);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntSub(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_sub(s, a, b))
+ goto exit;
+
+ BN_bn2bin(s, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntNeg(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL, *tmp2 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ tmp2 = (uint8_t *)malloc(SHARE_MEM01->size);
+ if (tmp2 == NULL)
+ goto exit;
+ memset(tmp2, 0, SHARE_MEM01->size);
+
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+ if (!BN_bin2bn(tmp2, SHARE_MEM01->size, b))
+ goto exit;
+
+ if (!BN_sub(s, b, a))
+ goto exit;
+
+ BN_bn2bin(s, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntCmp(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t ExpectedComparisonResult)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ op.params[3].value.a = ExpectedComparisonResult;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_VALUE_INPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntInit(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, uint32_t size_N)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = size_N;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntConvertFromS32AndToS32(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t sign, uint8_t *shortVal)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ if (sign)
+ tmp = tmp | BIT0_MASK;
+
+ op.params[0].value.a = (uint32_t)(*shortVal);
+ op.params[0].value.b = tmp;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntMul(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_mul(s, a, b, ctx))
+ goto exit;
+
+ BN_bn2bin(s, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntInvMod(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL, *tmp2 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+ if (res != TEE_SUCCESS)
+ goto exit;
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ tmp2 = (uint8_t *)malloc(SHARE_MEM01->size);
+ if (tmp2 == NULL)
+ goto exit;
+
+ memset(tmp2, 0, SHARE_MEM01->size);
+ tmp2[0] = 1;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM02->buffer), SHARE_MEM02->size,
+ b))
+ goto exit;
+
+ if (!BN_bin2bn(tmp2, SHARE_MEM01->size, l))
+ goto exit;
+
+ if (!BN_div(d, m, l, a, ctx))
+ goto exit;
+
+ if (!BN_div(s, m, d, b, ctx))
+ goto exit;
+
+ BN_bn2bin(m, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ if (tmp2)
+ free(tmp2);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntSquare(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N3)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+ uint8_t *tmp1 = NULL;
+
+ BN_DECLARE_AND_INIT()
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_SHARED_MEMORY(CONTEXT01, SHARE_MEM03, ((size_N3 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_OUTPUT)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(3, 0, SHARE_MEM03,
+ SHARE_MEM03->size)
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INOUT, TEEC_MEMREF_PARTIAL_INPUT, TEEC_NONE,
+ TEEC_MEMREF_PARTIAL_OUTPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ tmp1 = (uint8_t *)malloc(SHARE_MEM03->size);
+ if (tmp1 == NULL)
+ goto exit;
+
+ memset(tmp1, 0, SHARE_MEM03->size);
+
+ if (!BN_bin2bn((uint8_t *)(SHARE_MEM01->buffer), SHARE_MEM01->size,
+ a))
+ goto exit;
+
+ if (!BN_sqr(s, a, ctx))
+ goto exit;
+
+ BN_bn2bin(s, tmp1);
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, ==,
+ memcmp(tmp1, SHARE_MEM03->buffer,
+ SHARE_MEM03->size));
+
+exit:
+ if (tmp1)
+ free(tmp1);
+
+ BN_FREE()
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM03);
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntConvertToS32Overflow(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId, uint32_t size_N)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+
+ op.params[0].value.a = size_N;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+ return res;
+}
+
+static TEEC_Result Invoke_BigIntRelativePrime(
+ ADBG_Case_t *c, TEEC_Session *sess, uint32_t cmdId,
+ uint32_t size_N1, uint32_t sign1, uint8_t *value1,
+ uint32_t size_N2, uint32_t sign2, uint8_t *value2,
+ bool expectedBooleanResult)
+{
+ TEEC_Result res = TEE_ERROR_NOT_SUPPORTED;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t org;
+ uint32_t tmp = 0;
+
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM01,
+ ((size_N1 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value1)
+ ALLOCATE_AND_FILL_SHARED_MEMORY(CONTEXT01, SHARE_MEM02,
+ ((size_N2 + 7) / 8),
+ TEEC_MEMREF_PARTIAL_INPUT, value2)
+
+ if (sign1)
+ tmp = tmp | BIT0_MASK;
+ if (sign2)
+ tmp = tmp | BIT1_MASK;
+
+ op.params[0].value.a = tmp;
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(1, 0, SHARE_MEM01,
+ SHARE_MEM01->size)
+ SET_SHARED_MEMORY_OPERATION_PARAMETER(2, 0, SHARE_MEM02,
+ SHARE_MEM02->size)
+ op.params[3].value.a = (uint32_t)expectedBooleanResult;
+
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_MEMREF_PARTIAL_INPUT,
+ TEEC_MEMREF_PARTIAL_INPUT, TEEC_VALUE_INPUT);
+
+ res = TEEC_InvokeCommand(sess, cmdId, &op, &org);
+
+exit:
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_ReleaseSharedMemory(SHARE_MEM02);
+ return res;
+}
+
+#endif /* XML_TIMEARITHM_API_H_ */
diff --git a/host/xtest/xtest_1000.c b/host/xtest/xtest_1000.c
new file mode 100644
index 0000000..575188d
--- /dev/null
+++ b/host/xtest/xtest_1000.c
@@ -0,0 +1,839 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef USER_SPACE
+#include <pthread.h>
+#include <unistd.h>
+#endif
+
+#include "xtest_test.h"
+#include "xtest_helpers.h"
+
+#include <ta_crypt.h>
+#include <ta_os_test.h>
+#include <ta_create_fail_test.h>
+#include <ta_rpc_test.h>
+#include <ta_sims_test.h>
+
+static void xtest_tee_test_1001(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1004(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1005(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1006(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1007(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1008(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1009(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1010(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1011(ADBG_Case_t *Case_p);
+static void xtest_tee_test_1012(ADBG_Case_t *Case_p);
+
+ADBG_CASE_DEFINE(XTEST_TEE_1001, xtest_tee_test_1001,
+ /* Title */
+ "Registering TAs",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1004, xtest_tee_test_1004,
+ /* Title */
+ "Test User Crypt TA",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1005, xtest_tee_test_1005,
+ /* Title */
+ "Many sessions",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1006, xtest_tee_test_1006,
+ /* Title */
+ "Test Basic OS features",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1007, xtest_tee_test_1007,
+ /* Title */
+ "Test Panic",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1008, xtest_tee_test_1008,
+ /* Title */
+ "TEE internal client API",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1009, xtest_tee_test_1009,
+ /* Title */
+ "TEE Wait",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1010, xtest_tee_test_1010,
+ /* Title */
+ "Invalid memory access",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1011, xtest_tee_test_1011,
+ /* Title */
+ "Test RPC features with User Crypt TA",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_1012, xtest_tee_test_1012,
+ /* Title */
+ "Test Single Instance Multi Session features with SIMS TA",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+struct xtest_crypto_session {
+ ADBG_Case_t *c;
+ TEEC_Session *session;
+ uint32_t cmd_id_sha256;
+ uint32_t cmd_id_aes256ecb_encrypt;
+ uint32_t cmd_id_aes256ecb_decrypt;
+};
+
+static void xtest_crypto_test(struct xtest_crypto_session *cs)
+{
+ uint32_t ret_orig;
+ uint8_t crypt_out[16];
+ uint8_t crypt_in[16] = { 22, 17 };
+
+ crypt_in[15] = 60;
+
+ Do_ADBG_BeginSubCase(cs->c, "AES encrypt");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+
+ op.params[0].tmpref.buffer = crypt_in;
+ op.params[0].tmpref.size = sizeof(crypt_in);
+ op.params[1].tmpref.buffer = crypt_out;
+ op.params[1].tmpref.size = sizeof(crypt_out);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ TEEC_InvokeCommand(cs->session,
+ cs->
+ cmd_id_aes256ecb_encrypt,
+ &op,
+ &ret_orig));
+ }
+ Do_ADBG_EndSubCase(cs->c, "AES encrypt");
+
+ Do_ADBG_BeginSubCase(cs->c, "AES decrypt");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint8_t out[16];
+
+ op.params[0].tmpref.buffer = crypt_out;
+ op.params[0].tmpref.size = sizeof(crypt_out);
+ op.params[1].tmpref.buffer = out;
+ op.params[1].tmpref.size = sizeof(out);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ TEEC_InvokeCommand(cs->session,
+ cs->
+ cmd_id_aes256ecb_decrypt,
+ &op,
+ &ret_orig));
+
+ if (!ADBG_EXPECT(cs->c, 0,
+ memcmp(crypt_in, out, sizeof(crypt_in)))) {
+ Do_ADBG_Log("crypt_in:");
+ Do_ADBG_HexLog(crypt_in, sizeof(crypt_in), 16);
+ Do_ADBG_Log("out:");
+ Do_ADBG_HexLog(out, sizeof(out), 16);
+ }
+ }
+ Do_ADBG_EndSubCase(cs->c, "AES decrypt");
+
+ Do_ADBG_BeginSubCase(cs->c, "SHA-256 test, 3 bytes input");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ static const uint8_t sha256_in[] = { 'a', 'b', 'c' };
+ static const uint8_t sha256_out[] = {
+ 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
+ 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
+ 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
+ 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad
+ };
+ uint8_t out[32] = { 0 };
+
+ op.params[0].tmpref.buffer = (void *)sha256_in;
+ op.params[0].tmpref.size = sizeof(sha256_in);
+ op.params[1].tmpref.buffer = out;
+ op.params[1].tmpref.size = sizeof(out);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ TEEC_InvokeCommand(cs->session,
+ cs->
+ cmd_id_sha256,
+ &op,
+ &ret_orig));
+
+ if (!ADBG_EXPECT(cs->c, 0, memcmp(sha256_out, out,
+ sizeof(sha256_out)))) {
+ Do_ADBG_Log("sha256_out:");
+ Do_ADBG_HexLog(sha256_out, sizeof(sha256_out), 16);
+ Do_ADBG_Log("out:");
+ Do_ADBG_HexLog(out, sizeof(out), 16);
+ }
+ }
+ Do_ADBG_EndSubCase(cs->c, "SHA-256 test, 3 bytes input");
+
+ Do_ADBG_BeginSubCase(cs->c,
+ "AES-256 ECB encrypt test, 32 bytes input, with fixed key");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ static const uint8_t in[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
+ };
+ static const uint8_t exp_out[] = {
+ 0x5A, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
+ 0xF0, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
+ 0xE9, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
+ 0xF0, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x8E
+ };
+ uint8_t out[sizeof(exp_out)];
+
+ op.params[0].tmpref.buffer = (void *)in;
+ op.params[0].tmpref.size = sizeof(in);
+ op.params[1].tmpref.buffer = out;
+ op.params[1].tmpref.size = sizeof(out);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ TEEC_InvokeCommand(cs->session,
+ cs->
+ cmd_id_aes256ecb_encrypt,
+ &op,
+ &ret_orig));
+
+ if (!ADBG_EXPECT(cs->c, 0,
+ memcmp(exp_out, out, sizeof(exp_out)))) {
+ Do_ADBG_Log("exp_out:");
+ Do_ADBG_HexLog(exp_out, sizeof(exp_out), 16);
+ Do_ADBG_Log("out:");
+ Do_ADBG_HexLog(out, sizeof(out), 16);
+ }
+ }
+ Do_ADBG_EndSubCase(cs->c,
+ "AES-256 ECB encrypt test, 32 bytes input, with fixed key");
+
+ Do_ADBG_BeginSubCase(cs->c,
+ "AES-256 ECB decrypt test, 32 bytes input, with fixed key");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ static const uint8_t in[] = {
+ 0x5A, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
+ 0xF0, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
+ 0xE9, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
+ 0xF0, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x8E
+ };
+ static const uint8_t exp_out[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
+ };
+ uint8_t out[sizeof(exp_out)];
+
+ op.params[0].tmpref.buffer = (void *)in;
+ op.params[0].tmpref.size = sizeof(in);
+ op.params[1].tmpref.buffer = out;
+ op.params[1].tmpref.size = sizeof(out);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ TEEC_InvokeCommand(cs->session,
+ cs->
+ cmd_id_aes256ecb_decrypt,
+ &op,
+ &ret_orig));
+
+ if (!ADBG_EXPECT(cs->c, 0,
+ memcmp(exp_out, out, sizeof(exp_out)))) {
+ Do_ADBG_Log("exp_out:");
+ Do_ADBG_HexLog(exp_out, sizeof(exp_out), 16);
+ Do_ADBG_Log("out:");
+ Do_ADBG_HexLog(out, sizeof(out), 16);
+ }
+ }
+ Do_ADBG_EndSubCase(cs->c,
+ "AES-256 ECB decrypt test, 32 bytes input, with fixed key");
+}
+
+static void xtest_tee_test_1001(ADBG_Case_t *c)
+{
+#ifdef USER_SPACE
+ (void)c;
+#else
+#define REG_TA(name) \
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c, \
+ TEEC_RegisterTA(name, name ## _size))
+
+ REG_TA(crypt_user_ta);
+ REG_TA(os_test_ta);
+ REG_TA(create_fail_test_ta);
+ REG_TA(rpc_test_ta);
+ REG_TA(sims_test_ta);
+
+ TEEC_UnregisterTA(crypt_user_ta);
+ TEEC_UnregisterTA(os_test_ta);
+ TEEC_UnregisterTA(create_fail_test_ta);
+ TEEC_UnregisterTA(rpc_test_ta);
+ TEEC_UnregisterTA(sims_test_ta);
+
+ REG_TA(crypt_user_ta);
+ REG_TA(os_test_ta);
+ REG_TA(create_fail_test_ta);
+ REG_TA(rpc_test_ta);
+ REG_TA(sims_test_ta);
+ REG_TA(storage_ta);
+
+ REG_TA(gp_tta_testing_client_api_ta);
+ REG_TA(gp_tta_answer_success_to_open_session_invoke_ta);
+ REG_TA(gp_tta_answer_error_to_invoke_ta);
+ REG_TA(gp_tta_answer_error_to_open_session_ta);
+ REG_TA(gp_tta_check_open_session_with_4_parameters_ta);
+ REG_TA(gp_tta_time_ta);
+ REG_TA(gp_tta_ds_ta);
+ REG_TA(gp_tta_tcf_ta);
+ REG_TA(gp_tta_crypto_ta);
+ REG_TA(gp_tta_arithm_ta);
+ REG_TA(gp_tta_ica_ta);
+ REG_TA(gp_tta_ica2_ta);
+ REG_TA(gp_tta_tcf_singleinstance_ta);
+ REG_TA(gp_tta_tcf_multipleinstance_ta);
+#endif /*!USER_SPACE*/
+}
+
+static void xtest_tee_test_1004(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+ struct xtest_crypto_session cs = { c, &session, TA_CRYPT_CMD_SHA256,
+ TA_CRYPT_CMD_AES256ECB_ENC,
+ TA_CRYPT_CMD_AES256ECB_DEC };
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, xtest_teec_open_session(
+ &session, &crypt_user_ta_uuid,
+ NULL, &ret_orig)))
+ return;
+
+ /* Run the "complete crypto test suite" */
+ xtest_crypto_test(&cs);
+
+ TEEC_CloseSession(&session);
+}
+
+#ifndef TEEC_ERROR_TARGET_DEAD
+/* To be removed when we have TEEC_ERROR_TARGET_DEAD from tee_client_api.h */
+#define TEEC_ERROR_TARGET_DEAD 0xFFFF3024
+#endif
+
+static void xtest_tee_test_invalid_mem_access(ADBG_Case_t *c, uint32_t n)
+{
+ TEEC_Session session = { 0 };
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &os_test_ta_uuid, NULL,
+ &ret_orig));
+
+ op.params[0].value.a = n;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
+ TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_RESULT(c,
+ TEEC_ERROR_TARGET_DEAD,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_BAD_MEM_ACCESS, &op,
+ &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_TARGET_DEAD,
+ TEEC_InvokeCommand(&session,
+ TA_OS_TEST_CMD_BAD_MEM_ACCESS,
+ &op,
+ &ret_orig));
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TEE, ret_orig);
+
+ TEEC_CloseSession(&session);
+}
+
+static void xtest_tee_test_1005(ADBG_Case_t *c)
+{
+ uint32_t ret_orig;
+#define MAX_SESSIONS 3
+ TEEC_Session sessions[MAX_SESSIONS];
+ int i;
+
+ for (i = 0; i < MAX_SESSIONS; i++) {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sessions[i], &os_test_ta_uuid,
+ NULL, &ret_orig)))
+ break;
+ }
+
+ for (; --i >= 0; )
+ TEEC_CloseSession(&sessions[i]);
+}
+
+static void xtest_tee_test_1006(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint8_t buf[32];
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &os_test_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ op.params[0].tmpref.buffer = buf;
+ op.params[0].tmpref.size = sizeof(buf);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_BASIC, &op,
+ &ret_orig));
+
+ TEEC_CloseSession(&session);
+}
+
+static void xtest_tee_test_1007(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &os_test_ta_uuid, NULL,
+ &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_RESULT(c,
+ TEEC_ERROR_TARGET_DEAD,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_PANIC, NULL,
+ &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TEE, ret_orig);
+
+ (void)ADBG_EXPECT_TEEC_RESULT(c,
+ TEEC_ERROR_TARGET_DEAD,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_INIT, NULL,
+ &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TEE, ret_orig);
+
+ TEEC_CloseSession(&session);
+}
+
+static void xtest_tee_test_1008(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ TEEC_Session session_crypt = { 0 };
+ uint32_t ret_orig;
+
+ Do_ADBG_BeginSubCase(c, "Invoke command");
+ {
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session_crypt,
+ &crypt_user_ta_uuid, NULL,
+ &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &os_test_ta_uuid,
+ NULL, &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_CLIENT,
+ NULL, &ret_orig));
+
+ TEEC_CloseSession(&session);
+ TEEC_CloseSession(&session_crypt);
+ }
+ Do_ADBG_EndSubCase(c, "Invoke command");
+
+ Do_ADBG_BeginSubCase(c, "Invoke command with timeout");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+
+ op.params[0].value.a = 2000;
+ op.paramTypes = TEEC_PARAM_TYPES(
+ TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session,
+ &os_test_ta_uuid,
+ NULL,
+ &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session,
+ TA_OS_TEST_CMD_CLIENT_WITH_TIMEOUT,
+ &op, &ret_orig));
+
+ TEEC_CloseSession(&session);
+ }
+ Do_ADBG_EndSubCase(c, "Invoke command with timeout");
+
+ Do_ADBG_BeginSubCase(c, "Create session fail");
+ {
+ (void)ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_GENERIC,
+ xtest_teec_open_session(&session_crypt,
+ &create_fail_test_ta_uuid, NULL,
+ &ret_orig));
+ size_t n;
+
+ /*
+ * Run this several times to see that there's no memory leakage.
+ */
+ for (n = 0; n < 100; n++) {
+ Do_ADBG_Log("n = %zu", n);
+ (void)ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_GENERIC,
+ xtest_teec_open_session(&session_crypt,
+ &create_fail_test_ta_uuid,
+ NULL, &ret_orig));
+ }
+ }
+ Do_ADBG_EndSubCase(c, "Create session fail");
+}
+
+#ifdef USER_SPACE
+static void *cancellation_thread(void *arg)
+{
+ /*
+ * Sleep 0.5 seconds before cancellation to make sure that the other
+ * thread is in RPC_WAIT.
+ */
+ (void)usleep(500000);
+ TEEC_RequestCancellation(arg);
+ return NULL;
+}
+#endif
+
+static void xtest_tee_test_1009(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+
+ Do_ADBG_BeginSubCase(c, "TEE Wait 0.1s");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &os_test_ta_uuid,
+ NULL, &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+
+ op.params[0].value.a = 100;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_WAIT, &op,
+ &ret_orig));
+ TEEC_CloseSession(&session);
+ }
+ Do_ADBG_EndSubCase(c, "TEE Wait 0.1s");
+
+ Do_ADBG_BeginSubCase(c, "TEE Wait 0.5s");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &os_test_ta_uuid,
+ NULL, &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+
+ op.params[0].value.a = 500;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_WAIT, &op,
+ &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ TEEC_CloseSession(&session);
+ }
+ Do_ADBG_EndSubCase(c, "TEE Wait 0.5s");
+
+#ifdef USER_SPACE
+ Do_ADBG_BeginSubCase(c, "TEE Wait 2s cancel");
+ {
+ pthread_t thr;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &os_test_ta_uuid,
+ NULL, &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+
+ op.params[0].value.a = 2000;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT(c, 0,
+ pthread_create(&thr, NULL, cancellation_thread, &op));
+
+ (void)ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_CANCEL,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_WAIT, &op,
+ &ret_orig));
+
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ (void)ADBG_EXPECT(c, 0, pthread_join(thr, NULL));
+ TEEC_CloseSession(&session);
+ }
+ Do_ADBG_EndSubCase(c, "TEE Wait 2s cancel");
+#endif
+
+ Do_ADBG_BeginSubCase(c, "TEE Wait 2s");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &os_test_ta_uuid,
+ NULL, &ret_orig));
+
+ op.params[0].value.a = 2000;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session, TA_OS_TEST_CMD_WAIT, &op,
+ &ret_orig));
+
+ TEEC_CloseSession(&session);
+ }
+ Do_ADBG_EndSubCase(c, "TEE Wait 2s");
+}
+
+static void xtest_tee_test_1010(ADBG_Case_t *c)
+{
+ unsigned n;
+
+ for (n = 1; n <= 5; n++) {
+ Do_ADBG_BeginSubCase(c, "Invalid memory access %u", n);
+ xtest_tee_test_invalid_mem_access(c, n);
+ Do_ADBG_EndSubCase(c, "Invalid memory access %u", n);
+ }
+}
+
+static void xtest_tee_test_1011(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+ struct xtest_crypto_session cs = {
+ c, &session, TA_RPC_CMD_CRYPT_SHA256,
+ TA_RPC_CMD_CRYPT_AES256ECB_ENC,
+ TA_RPC_CMD_CRYPT_AES256ECB_DEC
+ };
+ TEEC_UUID uuid = rpc_test_ta_uuid;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &uuid, NULL, &ret_orig)))
+ return;
+
+ /*
+ * Run the "complete crypto test suite" using RPC
+ */
+ xtest_crypto_test(&cs);
+ TEEC_CloseSession(&session);
+}
+
+/*
+ * Note that this test is failing when
+ * - running twice in a raw
+ * - and the user TA is statically linked
+ * This is because the counter is not reseted when opening the first session
+ * in case the TA is statically linked
+ */
+static void xtest_tee_test_1012(ADBG_Case_t *c)
+{
+ TEEC_Session session1 = { 0 };
+ TEEC_Session session2 = { 0 };
+ uint32_t ret_orig;
+ TEEC_UUID uuid = sims_test_ta_uuid;
+
+ Do_ADBG_BeginSubCase(c, "Single Instance Multi Session");
+ {
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ static const uint8_t in[] = {
+ 0x5A, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
+ 0xF0, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
+ 0xE9, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
+ 0xF0, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x8E
+ };
+ uint8_t out[32] = { 0 };
+ int i;
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session1, &uuid, NULL,
+ &ret_orig));
+
+ op.params[0].value.a = 0;
+ op.params[1].tmpref.buffer = (void *)in;
+ op.params[1].tmpref.size = sizeof(in);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session1, TA_SIMS_CMD_WRITE, &op,
+ &ret_orig));
+
+ for (i = 1; i < 1000; i++) {
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session2, &uuid, NULL,
+ &ret_orig));
+
+ op.params[0].value.a = 0;
+ op.params[1].tmpref.buffer = out;
+ op.params[1].tmpref.size = sizeof(out);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session2, TA_SIMS_CMD_READ,
+ &op, &ret_orig));
+
+ if (!ADBG_EXPECT_BUFFER(c, in, sizeof(in), out,
+ sizeof(out))) {
+ Do_ADBG_Log("in:");
+ Do_ADBG_HexLog(in, sizeof(in), 16);
+ Do_ADBG_Log("out:");
+ Do_ADBG_HexLog(out, sizeof(out), 16);
+ }
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_OUTPUT,
+ TEEC_NONE, TEEC_NONE,
+ TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session1,
+ TA_SIMS_CMD_GET_COUNTER,
+ &op, &ret_orig));
+
+ (void)ADBG_EXPECT(c, 0, op.params[0].value.a);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session2,
+ TA_SIMS_CMD_GET_COUNTER, &op,
+ &ret_orig));
+
+ (void)ADBG_EXPECT(c, i, op.params[0].value.a);
+ TEEC_CloseSession(&session2);
+ }
+
+ memset(out, 0, sizeof(out));
+ op.params[0].value.a = 0;
+ op.params[1].tmpref.buffer = out;
+ op.params[1].tmpref.size = sizeof(out);
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ (void)ADBG_EXPECT_TEEC_SUCCESS(c,
+ TEEC_InvokeCommand(&session1, TA_SIMS_CMD_READ, &op,
+ &ret_orig));
+
+ if (!ADBG_EXPECT(c, 0, memcmp(in, out, sizeof(in)))) {
+ Do_ADBG_Log("in:");
+ Do_ADBG_HexLog(in, sizeof(in), 16);
+ Do_ADBG_Log("out:");
+ Do_ADBG_HexLog(out, sizeof(out), 16);
+ }
+
+ TEEC_CloseSession(&session1);
+ }
+}
diff --git a/host/xtest/xtest_10000.c b/host/xtest/xtest_10000.c
new file mode 100644
index 0000000..f402490
--- /dev/null
+++ b/host/xtest/xtest_10000.c
@@ -0,0 +1,843 @@
+/*
+ * Copyright (c) 2014, Linaro Limited
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include "xtest_test.h"
+#include "xtest_helpers.h"
+
+#include <tee_api_types.h>
+#include <tee_api_defines_extensions.h>
+#include <utee_defines.h>
+#include <string.h>
+#include <enc_fs_key_manager_test.h>
+
+#define WITH_HKDF 1
+#define WITH_CONCAT_KDF 1
+#define WITH_PBKDF2 1
+
+static void xtest_tee_test_10001(ADBG_Case_t *c);
+static void xtest_tee_test_10002(ADBG_Case_t *c);
+static void xtest_tee_test_10003(ADBG_Case_t *c);
+
+ADBG_CASE_DEFINE(XTEST_TEE_10001, xtest_tee_test_10001,
+ /* Title */
+ "Test TEE Internal API key derivation extensions",
+ /* Short description */
+ "Test non-standard cryptographic key derivation algorithms",
+ /* Requirement IDs */
+ "Linaro CARD-1661",
+ /* How to implement */
+ "Invoke key derivation functions with standard test vectors"
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_10002, xtest_tee_test_10002,
+ /* Title */
+ "Secure Storage Key Manager API Self Test",
+ /* Short description */
+ "Test secure storage key manager functionality",
+ /* Requirement IDs */
+ "Linaro SWG-176",
+ /* How to implement */
+ "Invoke key manager self test function in test TA"
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_10003, xtest_tee_test_10003,
+ /* Title */
+ "ECC Self Test",
+ /* Short description */
+ "Test ECC API",
+ /* Requirement IDs */
+ "",
+ /* How to implement */
+ "Invoke ECC self test function in test TA"
+ );
+
+/*
+ * HKDF test data from RFC 5869
+ */
+
+/* A.1 SHA-256 */
+
+static const uint8_t hkdf_a1_ikm[] = {
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b
+};
+
+static const uint8_t hkdf_a1_salt[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c
+};
+
+static const uint8_t hkdf_a1_info[] = {
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9
+};
+
+static const uint8_t hkdf_a1_okm[] = {
+ 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a,
+ 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a,
+ 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c,
+ 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf,
+ 0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18,
+ 0x58, 0x65
+};
+
+/* A.2 SHA-256 */
+static const uint8_t hkdf_a2_ikm[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f
+};
+
+static const uint8_t hkdf_a2_salt[] = {
+ 0x60, 0x61, 0x62, 0x63, 0x64,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x03, 0x27, 0xa1,
+ 0xc8, 0xe7, 0xf7, 0x8c, 0x59, 0x6a, 0x49, 0x34,
+ 0x4f, 0x01, 0x2e, 0xda, 0x2d, 0x4e, 0xfa, 0xd8,
+ 0xa0, 0x50, 0xcc, 0x4c, 0x19, 0xaf, 0xa9, 0x7c,
+ 0x59, 0x04, 0x5a, 0x99, 0xca, 0xc7, 0x82, 0x72,
+ 0x71, 0xcb, 0x41, 0xc6, 0x5e, 0x59, 0x0e, 0x09,
+ 0xda, 0x32, 0x75, 0x60, 0x0c, 0x2f, 0x09, 0xb8,
+ 0x36, 0x77, 0x93, 0xa9, 0xac, 0xa3, 0xdb, 0x71,
+ 0xcc, 0x30, 0xc5, 0x81, 0x79, 0xec, 0x3e, 0x87,
+ 0xc1, 0x4c, 0x01, 0xd5, 0xc1, 0xf3, 0x43, 0x4f,
+ 0x1d, 0x87
+};
+
+/* A.3 SHA-256 */
+#define hkdf_a3_ikm hkdf_a1_ikm
+static const uint8_t hkdf_a3_salt[] = {};
+
+static const uint8_t hkdf_a3_info[] = {};
+
+static const uint8_t hkdf_a3_okm[] = {
+ 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f,
+ 0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31,
+ 0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e,
+ 0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d,
+ 0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a,
+ 0x96, 0xc8
+};
+
+/* A.4 SHA-1 */
+static const uint8_t hkdf_a4_ikm[] = {
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b
+};
+
+static const uint8_t hkdf_a4_salt[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c
+};
+
+static const uint8_t hkdf_a4_info[] = {
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9
+};
+
+static const uint8_t hkdf_a4_okm[] = {
+ 0x08, 0x5a, 0x01, 0xea, 0x1b, 0x10, 0xf3, 0x69,
+ 0x33, 0x06, 0x8b, 0x56, 0xef, 0xa5, 0xad, 0x81,
+ 0xa4, 0xf1, 0x4b, 0x82, 0x2f, 0x5b, 0x09, 0x15,
+ 0x68, 0xa9, 0xcd, 0xd4, 0xf1, 0x55, 0xfd, 0xa2,
+ 0xc2, 0x2e, 0x42, 0x24, 0x78, 0xd3, 0x05, 0xf3,
+ 0xf8, 0x96
+};
+
+/* A.5 SHA-1 */
+#define hkdf_a5_ikm hkdf_a2_ikm
+#define hkdf_a5_salt hkdf_a2_salt
+#define hkdf_a5_info hkdf_a2_info
+static const uint8_t hkdf_a5_okm[] = {
+ 0x0b, 0xd7, 0x70, 0xa7, 0x4d, 0x11, 0x60, 0xf7,
+ 0xc9, 0xf1, 0x2c, 0xd5, 0x91, 0x2a, 0x06, 0xeb,
+ 0xff, 0x6a, 0xdc, 0xae, 0x89, 0x9d, 0x92, 0x19,
+ 0x1f, 0xe4, 0x30, 0x56, 0x73, 0xba, 0x2f, 0xfe,
+ 0x8f, 0xa3, 0xf1, 0xa4, 0xe5, 0xad, 0x79, 0xf3,
+ 0xf3, 0x34, 0xb3, 0xb2, 0x02, 0xb2, 0x17, 0x3c,
+ 0x48, 0x6e, 0xa3, 0x7c, 0xe3, 0xd3, 0x97, 0xed,
+ 0x03, 0x4c, 0x7f, 0x9d, 0xfe, 0xb1, 0x5c, 0x5e,
+ 0x92, 0x73, 0x36, 0xd0, 0x44, 0x1f, 0x4c, 0x43,
+ 0x00, 0xe2, 0xcf, 0xf0, 0xd0, 0x90, 0x0b, 0x52,
+ 0xd3, 0xb4
+};
+
+/* A.6 SHA-1 */
+#define hkdf_a6_ikm hkdf_a1_ikm
+static const uint8_t hkdf_a6_salt[] = {};
+
+static const uint8_t hkdf_a6_info[] = {};
+
+static const uint8_t hkdf_a6_okm[] = {
+ 0x0a, 0xc1, 0xaf, 0x70, 0x02, 0xb3, 0xd7, 0x61,
+ 0xd1, 0xe5, 0x52, 0x98, 0xda, 0x9d, 0x05, 0x06,
+ 0xb9, 0xae, 0x52, 0x05, 0x72, 0x20, 0xa3, 0x06,
+ 0xe0, 0x7b, 0x6b, 0x87, 0xe8, 0xdf, 0x21, 0xd0,
+ 0xea, 0x00, 0x03, 0x3d, 0xe0, 0x39, 0x84, 0xd3,
+ 0x49, 0x18
+};
+
+/* A.7 SHA-1 */
+static const uint8_t hkdf_a7_ikm[] = {
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
+ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c
+};
+
+static const uint8_t hkdf_a7_salt[] = {};
+
+static const uint8_t hkdf_a7_info[] = {};
+
+static const uint8_t hkdf_a7_okm[] = {
+ 0x2c, 0x91, 0x11, 0x72, 0x04, 0xd7, 0x45, 0xf3,
+ 0x50, 0x0d, 0x63, 0x6a, 0x62, 0xf6, 0x4f, 0x0a,
+ 0xb3, 0xba, 0xe5, 0x48, 0xaa, 0x53, 0xd4, 0x23,
+ 0xb0, 0xd1, 0xf2, 0x7e, 0xbb, 0xa6, 0xf5, 0xe5,
+ 0x67, 0x3a, 0x08, 0x1d, 0x70, 0xcc, 0xe7, 0xac,
+ 0xfc, 0x48
+};
+
+/*
+ * Concat KDF (NIST SP 800-56A R1)
+ *
+ * Test vector from:
+ * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-37
+ * appendix C
+ */
+static const uint8_t concat_kdf_1_z[] = {
+ 158, 86, 217, 29, 129, 113, 53, 211,
+ 114, 131, 66, 131, 191, 132, 38, 156,
+ 251, 49, 110, 163, 218, 128, 106, 72,
+ 246, 218, 167, 121, 140, 254, 144, 196
+};
+
+static const uint8_t concat_kdf_1_other_info[] = {
+ 0, 0, 0, 7, 65, 49, 50, 56,
+ 71, 67, 77, 0, 0, 0, 5, 65,
+ 108, 105, 99, 101, 0, 0, 0, 3,
+ 66, 111, 98, 0, 0, 0, 128
+};
+
+static const uint8_t concat_kdf_1_derived_key[] = {
+ 86, 170, 141, 234, 248, 35, 109, 32,
+ 92, 34, 40, 205, 113, 167, 16, 26
+};
+
+/*
+ * PKCS #5 2.0 / RFC 2898 Key Derivation Function 2 (PBKDF2)
+ * Test vectors from RFC 6070 https://www.ietf.org/rfc/rfc6070.txt
+ */
+
+/* 1 */
+static const uint8_t pbkdf2_1_password[] = {
+ 'p', 'a', 's', 's', 'w', 'o', 'r', 'd'
+};
+
+static const uint8_t pbkdf2_1_salt[] = {
+ 's', 'a', 'l', 't'
+};
+
+#define pbkdf2_1_iteration_count 1
+static const uint8_t pbkdf2_1_dkm[] = {
+ 0x0c, 0x60, 0xc8, 0x0f, 0x96, 0x1f, 0x0e, 0x71,
+ 0xf3, 0xa9, 0xb5, 0x24, 0xaf, 0x60, 0x12, 0x06,
+ 0x2f, 0xe0, 0x37, 0xa6
+};
+
+/* 2 */
+#define pbkdf2_2_password pbkdf2_1_password
+#define pbkdf2_2_salt pbkdf2_1_salt
+#define pbkdf2_2_iteration_count 2
+static const uint8_t pbkdf2_2_dkm[] = {
+ 0xea, 0x6c, 0x01, 0x4d, 0xc7, 0x2d, 0x6f, 0x8c,
+ 0xcd, 0x1e, 0xd9, 0x2a, 0xce, 0x1d, 0x41, 0xf0,
+ 0xd8, 0xde, 0x89, 0x57
+};
+
+/* 3 */
+#define pbkdf2_3_password pbkdf2_1_password
+#define pbkdf2_3_salt pbkdf2_1_salt
+#define pbkdf2_3_iteration_count 4096
+static const uint8_t pbkdf2_3_dkm[] = {
+ 0x4b, 0x00, 0x79, 0x01, 0xb7, 0x65, 0x48, 0x9a,
+ 0xbe, 0xad, 0x49, 0xd9, 0x26, 0xf7, 0x21, 0xd0,
+ 0x65, 0xa4, 0x29, 0xc1
+};
+
+/* 4 */
+#define pbkdf2_4_password pbkdf2_1_password
+#define pbkdf2_4_salt pbkdf2_1_salt
+#define pbkdf2_4_iteration_count 16777216
+static const uint8_t pbkdf2_4_dkm[] = {
+ 0xee, 0xfe, 0x3d, 0x61, 0xcd, 0x4d, 0xa4, 0xe4,
+ 0xe9, 0x94, 0x5b, 0x3d, 0x6b, 0xa2, 0x15, 0x8c,
+ 0x26, 0x34, 0xe9, 0x84
+};
+
+/* 5 */
+static const uint8_t pbkdf2_5_password[] = {
+ 'p', 'a', 's', 's', 'w', 'o', 'r', 'd',
+ 'P', 'A', 'S', 'S', 'W', 'O', 'R', 'D',
+ 'p', 'a', 's', 's', 'w', 'o', 'r', 'd'
+};
+
+static const uint8_t pbkdf2_5_salt[] = {
+ 's', 'a', 'l', 't', 'S', 'A', 'L', 'T',
+ 's', 'a', 'l', 't', 'S', 'A', 'L', 'T',
+ 's', 'a', 'l', 't', 'S', 'A', 'L', 'T',
+ 's', 'a', 'l', 't', 'S', 'A', 'L', 'T',
+ 's', 'a', 'l', 't'
+};
+
+#define pbkdf2_5_iteration_count 4096
+static const uint8_t pbkdf2_5_dkm[] = {
+ 0x3d, 0x2e, 0xec, 0x4f, 0xe4, 0x1c, 0x84, 0x9b,
+ 0x80, 0xc8, 0xd8, 0x36, 0x62, 0xc0, 0xe4, 0x4a,
+ 0x8b, 0x29, 0x1a, 0x96, 0x4c, 0xf2, 0xf0, 0x70,
+ 0x38
+};
+
+/* 6 */
+static const uint8_t pbkdf2_6_password[] = {
+ 'p', 'a', 's', 's', '\0', 'w', 'o', 'r',
+ 'd',
+};
+
+static const uint8_t pbkdf2_6_salt[] = {
+ 's', 'a', '\0', 'l', 't'
+};
+
+#define pbkdf2_6_iteration_count 4096
+static const uint8_t pbkdf2_6_dkm[] = {
+ 0x56, 0xfa, 0x6a, 0xa7, 0x55, 0x48, 0x09, 0x9d,
+ 0xcc, 0x37, 0xd7, 0xf0, 0x34, 0x25, 0xe0, 0xc3
+};
+
+#ifdef WITH_HKDF
+static void xtest_test_derivation_hkdf(ADBG_Case_t *c, TEEC_Session *session)
+{
+ size_t n;
+#define TEST_HKDF_DATA(section, algo, id, oeb /* omit empty bufs */) \
+ { \
+ section, algo, \
+ hkdf_##id##_ikm, sizeof(hkdf_##id##_ikm), \
+ (oeb && !sizeof(hkdf_##id##_salt)) ? NULL : hkdf_##id##_salt, sizeof(hkdf_##id##_salt), \
+ (oeb && !sizeof(hkdf_##id##_info)) ? NULL : hkdf_##id##_info, sizeof(hkdf_##id##_info), \
+ hkdf_##id##_okm, sizeof(hkdf_##id##_okm), \
+ }
+ static struct hkdf_case {
+ const char *subcase_name;
+ uint32_t algo;
+ const uint8_t *ikm;
+ size_t ikm_len;
+ const uint8_t *salt;
+ size_t salt_len;
+ const uint8_t *info;
+ size_t info_len;
+ const uint8_t *okm;
+ size_t okm_len;
+ } hkdf_cases[] = {
+ TEST_HKDF_DATA("A.1 (SHA-256)",
+ TEE_ALG_HKDF_SHA256_DERIVE_KEY, a1, false),
+ TEST_HKDF_DATA("A.2 (SHA-256)",
+ TEE_ALG_HKDF_SHA256_DERIVE_KEY, a2, false),
+ TEST_HKDF_DATA("A.3 (SHA-256) [1]",
+ TEE_ALG_HKDF_SHA256_DERIVE_KEY, a3, false),
+ TEST_HKDF_DATA("A.3 (SHA-256) [2]",
+ TEE_ALG_HKDF_SHA256_DERIVE_KEY, a3, true),
+ TEST_HKDF_DATA("A.4 (SHA-1)",
+ TEE_ALG_HKDF_SHA1_DERIVE_KEY, a4, false),
+ TEST_HKDF_DATA("A.5 (SHA-1)",
+ TEE_ALG_HKDF_SHA1_DERIVE_KEY, a5, false),
+ TEST_HKDF_DATA("A.6 (SHA-1) [1]",
+ TEE_ALG_HKDF_SHA1_DERIVE_KEY, a6, false),
+ TEST_HKDF_DATA("A.6 (SHA-1) [2]",
+ TEE_ALG_HKDF_SHA1_DERIVE_KEY, a6, true),
+ TEST_HKDF_DATA("A.7 (SHA-1) [1]",
+ TEE_ALG_HKDF_SHA1_DERIVE_KEY, a7, false),
+ TEST_HKDF_DATA("A.7 (SHA-1) [2]",
+ TEE_ALG_HKDF_SHA1_DERIVE_KEY, a7, true),
+ };
+ size_t max_size = 2048;
+
+ for (n = 0; n < sizeof(hkdf_cases) / sizeof(struct hkdf_case); n++) {
+ TEE_OperationHandle op;
+ TEE_ObjectHandle key_handle;
+ TEE_ObjectHandle sv_handle;
+ TEE_Attribute params[4];
+ size_t param_count = 0;
+ uint8_t out[2048];
+ size_t out_size;
+ const struct hkdf_case *hc = &hkdf_cases[n];
+
+ Do_ADBG_BeginSubCase(c, "HKDF RFC 5869 %s", hc->subcase_name);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, session, &op,
+ hc->algo, TEE_MODE_DERIVE, max_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, session,
+ TEE_TYPE_HKDF_IKM, max_size, &key_handle)))
+ goto out;
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_HKDF_IKM, hc->ikm,
+ hc->ikm_len);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, session,
+ key_handle, params, param_count)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, session, op,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, session,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, session,
+ TEE_TYPE_GENERIC_SECRET, hc->okm_len * 8,
+ &sv_handle)))
+ goto out;
+
+ param_count = 0;
+
+ if (hc->salt)
+ xtest_add_attr(¶m_count, params, TEE_ATTR_HKDF_SALT,
+ hc->salt, hc->salt_len);
+ if (hc->info)
+ xtest_add_attr(¶m_count, params, TEE_ATTR_HKDF_INFO,
+ hc->info, hc->info_len);
+
+ params[param_count].attributeID = TEE_ATTR_HKDF_OKM_LENGTH;
+ params[param_count].content.value.a = hc->okm_len;
+ params[param_count].content.value.b = 0;
+ param_count++;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_derive_key(c, session, op, sv_handle,
+ params, param_count)))
+ goto out;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_get_object_buffer_attribute(c, session,
+ sv_handle, TEE_ATTR_SECRET_VALUE, out,
+ &out_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_BUFFER(c, hc->okm, hc->okm_len, out, out_size))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, session, op)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, session,
+ sv_handle)))
+ goto out;
+ out:
+ Do_ADBG_EndSubCase(c, "HKDF RFC 5869 %s", hc->subcase_name);
+ }
+}
+#endif /* WITH_HKDF */
+
+#ifdef WITH_CONCAT_KDF
+static void xtest_test_derivation_concat_kdf(ADBG_Case_t *c, TEEC_Session *session)
+{
+ size_t n;
+#define TEST_CONCAT_KDF_DATA(name, algo, id, oeb /* omit empty bufs */) \
+ { \
+ name, algo, \
+ concat_kdf_##id##_z, sizeof(concat_kdf_##id##_z), \
+ (oeb && !sizeof(concat_kdf_##id##_other_info)) ? NULL \
+ : concat_kdf_##id##_other_info, \
+ sizeof(concat_kdf_##id##_other_info), \
+ concat_kdf_##id##_derived_key, sizeof(concat_kdf_##id##_derived_key), \
+ }
+ static struct concat_kdf_case {
+ const char *subcase_name;
+ uint32_t algo;
+ const uint8_t *shared_secret;
+ size_t shared_secret_len;
+ const uint8_t *other_info;
+ size_t other_info_len;
+ const uint8_t *derived_key;
+ size_t derived_key_len;
+ } concat_kdf_cases[] = {
+ TEST_CONCAT_KDF_DATA("JWA-37 C (SHA-256)",
+ TEE_ALG_CONCAT_KDF_SHA256_DERIVE_KEY, 1, false),
+ };
+ size_t max_size = 2048;
+
+ for (n = 0;
+ n < sizeof(concat_kdf_cases) / sizeof(struct concat_kdf_case);
+ n++) {
+ TEE_OperationHandle op;
+ TEE_ObjectHandle key_handle;
+ TEE_ObjectHandle sv_handle;
+ TEE_Attribute params[4];
+ size_t param_count = 0;
+ uint8_t out[2048];
+ size_t out_size;
+ const struct concat_kdf_case *cc = &concat_kdf_cases[n];
+
+ Do_ADBG_BeginSubCase(c, "Concat KDF %s", cc->subcase_name);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, session, &op,
+ cc->algo, TEE_MODE_DERIVE, max_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, session,
+ TEE_TYPE_CONCAT_KDF_Z, max_size, &key_handle)))
+ goto out;
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_CONCAT_KDF_Z,
+ cc->shared_secret, cc->shared_secret_len);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, session,
+ key_handle, params, param_count)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, session, op,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, session,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, session,
+ TEE_TYPE_GENERIC_SECRET, cc->derived_key_len *
+ 8, &sv_handle)))
+ goto out;
+
+ param_count = 0;
+
+ if (cc->other_info)
+ xtest_add_attr(¶m_count, params,
+ TEE_ATTR_CONCAT_KDF_OTHER_INFO,
+ cc->other_info, cc->other_info_len);
+
+ params[param_count].attributeID = TEE_ATTR_CONCAT_KDF_DKM_LENGTH;
+ params[param_count].content.value.a = cc->derived_key_len;
+ params[param_count].content.value.b = 0;
+ param_count++;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_derive_key(c, session, op, sv_handle,
+ params, param_count)))
+ goto out;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_get_object_buffer_attribute(c, session,
+ sv_handle, TEE_ATTR_SECRET_VALUE, out,
+ &out_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_BUFFER(c, cc->derived_key, cc->derived_key_len,
+ out, out_size))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, session, op)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, session,
+ sv_handle)))
+ goto out;
+out:
+ Do_ADBG_EndSubCase(c, "Concat KDF %s", cc->subcase_name);
+ }
+}
+#endif /* WITH_CONCAT_KDF */
+
+#ifdef WITH_PBKDF2
+static void xtest_test_derivation_pbkdf2(ADBG_Case_t *c, TEEC_Session *session)
+{
+ size_t n;
+#define TEST_PBKDF2_DATA(section, algo, id, oeb /* omit empty bufs */) \
+ { \
+ section, algo, \
+ pbkdf2_##id##_password, sizeof(pbkdf2_##id##_password), \
+ (oeb && !sizeof(pbkdf2_##id##_salt)) ? NULL : pbkdf2_##id##_salt, sizeof(pbkdf2_##id##_salt), \
+ pbkdf2_##id##_iteration_count, \
+ pbkdf2_##id##_dkm, sizeof(pbkdf2_##id##_dkm), \
+ }
+#define _TO_STR(n) #n
+#define TO_STR(n) _TO_STR(n)
+#define RFC6070_TEST(n) \
+ TEST_PBKDF2_DATA("RFC 6070 " TO_STR(n) " (HMAC-SHA1)", \
+ TEE_ALG_PBKDF2_HMAC_SHA1_DERIVE_KEY, n, false)
+ static struct pbkdf2_case {
+ const char *subcase_name;
+ uint32_t algo;
+ const uint8_t *password;
+ size_t password_len;
+ const uint8_t *salt;
+ size_t salt_len;
+ uint32_t iteration_count;
+ const uint8_t *dkm;
+ size_t dkm_len;
+ } pbkdf2_cases[] = {
+ RFC6070_TEST(1), RFC6070_TEST(2), RFC6070_TEST(3),
+#if 0
+ RFC6070_TEST(4), /* Lengthy! (3 min on my PC / QEMU) */
+#endif
+ RFC6070_TEST(5), RFC6070_TEST(6)
+ };
+ size_t max_size = 2048;
+
+ for (n = 0; n < sizeof(pbkdf2_cases) / sizeof(struct pbkdf2_case); n++) {
+ TEE_OperationHandle op;
+ TEE_ObjectHandle key_handle;
+ TEE_ObjectHandle sv_handle;
+ TEE_Attribute params[4];
+ size_t param_count = 0;
+ uint8_t out[2048];
+ size_t out_size;
+ const struct pbkdf2_case *pc = &pbkdf2_cases[n];
+
+ Do_ADBG_BeginSubCase(c, "PBKDF2 %s", pc->subcase_name);
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, session, &op,
+ pc->algo, TEE_MODE_DERIVE, max_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, session,
+ TEE_TYPE_PBKDF2_PASSWORD, max_size,
+ &key_handle)))
+ goto out;
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_PBKDF2_PASSWORD,
+ pc->password, pc->password_len);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, session,
+ key_handle, params, param_count)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, session, op,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, session,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, session,
+ TEE_TYPE_GENERIC_SECRET, pc->dkm_len * 8,
+ &sv_handle)))
+ goto out;
+
+ param_count = 0;
+
+ if (pc->salt)
+ xtest_add_attr(¶m_count, params,
+ TEE_ATTR_PBKDF2_SALT, pc->salt,
+ pc->salt_len);
+
+ params[param_count].attributeID = TEE_ATTR_PBKDF2_DKM_LENGTH;
+ params[param_count].content.value.a = pc->dkm_len;
+ params[param_count].content.value.b = 0;
+ param_count++;
+
+ params[param_count].attributeID =
+ TEE_ATTR_PBKDF2_ITERATION_COUNT;
+ params[param_count].content.value.a = pc->iteration_count;
+ params[param_count].content.value.b = 0;
+ param_count++;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_derive_key(c, session, op, sv_handle,
+ params, param_count)))
+ goto out;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_get_object_buffer_attribute(c, session,
+ sv_handle, TEE_ATTR_SECRET_VALUE, out, &out_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_BUFFER(c, pc->dkm, pc->dkm_len, out, out_size))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, session, op)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, session,
+ sv_handle)))
+ goto out;
+out:
+ Do_ADBG_EndSubCase(c, "PBKDF2 %s", pc->subcase_name);
+ }
+}
+#endif /* WITH_PBKDF2 */
+
+static TEEC_Result enc_fs_km_self_test(TEEC_Session *sess)
+{
+ TEEC_Operation op;
+ TEEC_Result res;
+ uint32_t org;
+
+ memset(&op, 0, sizeof(op));
+ res = TEEC_InvokeCommand(sess, CMD_SELF_TESTS, &op, &org);
+ return res;
+}
+
+#define CMD_ECC_GEN_KEY_SELF_TESTS 0
+static TEEC_Result ecc_self_test(TEEC_Session *sess, uint32_t algo)
+{
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ TEEC_Result res;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = algo;
+ op.params[0].value.b = 0;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+ res = TEEC_InvokeCommand(sess, CMD_ECC_GEN_KEY_SELF_TESTS,
+ &op, &ret_orig);
+ return res;
+}
+
+static void xtest_tee_test_10001(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+#ifdef WITH_HKDF
+ xtest_test_derivation_hkdf(c, &session);
+#endif
+#ifdef WITH_CONCAT_KDF
+ xtest_test_derivation_concat_kdf(c, &session);
+#endif
+#ifdef WITH_PBKDF2
+ xtest_test_derivation_pbkdf2(c, &session);
+#endif
+
+ TEEC_CloseSession(&session);
+}
+
+/* secure storage key manager self test */
+static void xtest_tee_test_10002(ADBG_Case_t *c)
+{
+ TEEC_Result res;
+ TEEC_Session sess;
+ uint32_t orig;
+
+ res = xtest_teec_open_session(&sess,
+ &enc_fs_key_manager_test_ta_uuid,
+ NULL, &orig);
+ if (res != TEEC_SUCCESS) {
+ Do_ADBG_Log("Ignore test due to TA does not exist");
+ return;
+ }
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(
+ c, enc_fs_km_self_test(&sess)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+/* ECC self test */
+static void xtest_tee_test_10003(ADBG_Case_t *c)
+{
+ TEEC_Result res;
+ TEEC_Session sess;
+ uint32_t orig;
+ uint32_t algo;
+
+ res = xtest_teec_open_session(&sess, &ecc_test_ta_uuid, NULL, &orig);
+ if (res != TEEC_SUCCESS) {
+ Do_ADBG_Log("Ignore test due to TA does not exist");
+ return;
+ }
+
+ for (algo = TEE_ECC_CURVE_NIST_P192;
+ algo <= TEE_ECC_CURVE_NIST_P521;
+ algo++) {
+ Do_ADBG_BeginSubCase(c, "ECC Generate Key algo=0x%x", algo);
+ ADBG_EXPECT_TEEC_SUCCESS(c, ecc_self_test(&sess, algo));
+ Do_ADBG_EndSubCase(c, "ECC Generate Key algo=0x%x", algo);
+ }
+
+ algo = TEE_ECC_CURVE_NIST_P521+1;
+ Do_ADBG_BeginSubCase(c, "ECC Generate Key algo=0x%x", algo);
+ ADBG_EXPECT(c, TEE_ERROR_NOT_SUPPORTED, ecc_self_test(&sess, algo));
+ Do_ADBG_EndSubCase(c, "ECC Generate Key algo=0x%x", algo);
+
+ TEEC_CloseSession(&sess);
+}
diff --git a/host/xtest/xtest_4000.c b/host/xtest/xtest_4000.c
new file mode 100644
index 0000000..35176e2
--- /dev/null
+++ b/host/xtest/xtest_4000.c
@@ -0,0 +1,4056 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+#include <malloc.h>
+
+#include "xtest_test.h"
+#include "xtest_helpers.h"
+
+#include <tee_api_types.h>
+#include <ta_crypt.h>
+#include <utee_defines.h>
+#include <util.h>
+
+#include <xtest_4000_data.h>
+
+#include <assert.h>
+
+static void xtest_tee_test_4001(ADBG_Case_t *Case_p);
+static void xtest_tee_test_4002(ADBG_Case_t *Case_p);
+static void xtest_tee_test_4003_no_xts(ADBG_Case_t *Case_p);
+static void xtest_tee_test_4003_xts(ADBG_Case_t *Case_p);
+static void xtest_tee_test_4004(ADBG_Case_t *Case_p);
+static void xtest_tee_test_4005(ADBG_Case_t *Case_p);
+static void xtest_tee_test_4006(ADBG_Case_t *Case_p);
+static void xtest_tee_test_4007(ADBG_Case_t *Case_p);
+static void xtest_tee_test_4008(ADBG_Case_t *Case_p);
+
+ADBG_CASE_DEFINE(XTEST_TEE_4001, xtest_tee_test_4001,
+ /* Title */
+ "Test TEE Internal API hash operations",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_4002, xtest_tee_test_4002,
+ /* Title */
+ "Test TEE Internal API MAC operations",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_4003_NO_XTS, xtest_tee_test_4003_no_xts,
+ /* Title */
+ "Test TEE Internal API cipher operations without AES XTS",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_4003_XTS, xtest_tee_test_4003_xts,
+ /* Title */
+ "Test TEE Internal API cipher operations for AES XTS",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_4004, xtest_tee_test_4004,
+ /* Title */
+ "Test TEE Internal API get random",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_4005, xtest_tee_test_4005,
+ /* Title */
+ "Test TEE Internal API Authenticated Encryption operations",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_4006, xtest_tee_test_4006,
+ /* Title */
+ "Test TEE Internal API Asymmetric Cipher operations",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_4007, xtest_tee_test_4007,
+ /* Title */
+ "Test TEE Internal API Generate key",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(XTEST_TEE_4008, xtest_tee_test_4008,
+ /* Title */
+ "Test TEE Internal API Derive key",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+static TEEC_Result ta_crypt_cmd_random_number_generate(ADBG_Case_t *c,
+ TEEC_Session *s,
+ void *buf, size_t blen);
+
+static TEEC_Result ta_crypt_cmd_reset_operation(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
+ TEEC_NONE);
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_RESET_OPERATION, &op,
+ &ret_orig);
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_copy_operation(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle dst_oph,
+ TEE_OperationHandle src_oph)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)dst_oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)dst_oph;
+
+ assert((uintptr_t)src_oph <= UINT32_MAX);
+ op.params[0].value.b = (uint32_t)(uintptr_t)src_oph;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_COPY_OPERATION, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_digest_update(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *chunk,
+ size_t chunk_size)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+ op.params[1].tmpref.buffer = (void *)chunk;
+ op.params[1].tmpref.size = chunk_size;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_DIGEST_UPDATE, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_digest_do_final(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *chunk,
+ size_t chunk_len, void *hash,
+ size_t *hash_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)chunk;
+ op.params[1].tmpref.size = chunk_len;
+
+ op.params[2].tmpref.buffer = (void *)hash;
+ op.params[2].tmpref.size = *hash_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_DIGEST_DO_FINAL, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *hash_len = op.params[2].tmpref.size;
+
+ return res;
+}
+
+static TEE_Result ta_crypt_cmd_set_operation_key2(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ TEE_ObjectHandle key1,
+ TEE_ObjectHandle key2)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ assert((uintptr_t)key1 <= UINT32_MAX);
+ op.params[0].value.b = (uint32_t)(uintptr_t)key1;
+
+ assert((uintptr_t)key2 <= UINT32_MAX);
+ op.params[1].value.a = (uint32_t)(uintptr_t)key2;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_VALUE_INPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_SET_OPERATION_KEY2, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_mac_init(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *iv, size_t iv_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ if (iv != NULL) {
+ op.params[1].tmpref.buffer = (void *)iv;
+ op.params[1].tmpref.size = iv_len;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_NONE, TEEC_NONE);
+ } else {
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+ }
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_MAC_INIT, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_mac_update(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *chunk, size_t chunk_size)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)chunk;
+ op.params[1].tmpref.size = chunk_size;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_MAC_UPDATE, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_mac_final_compute(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *chunk,
+ size_t chunk_len,
+ void *hash,
+ size_t *hash_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)chunk;
+ op.params[1].tmpref.size = chunk_len;
+
+ op.params[2].tmpref.buffer = (void *)hash;
+ op.params[2].tmpref.size = *hash_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_MAC_FINAL_COMPUTE, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *hash_len = op.params[2].tmpref.size;
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_cipher_init(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *iv, size_t iv_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ if (iv != NULL) {
+ op.params[1].tmpref.buffer = (void *)iv;
+ op.params[1].tmpref.size = iv_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_NONE, TEEC_NONE);
+ } else {
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+ }
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_CIPHER_INIT, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_cipher_update(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *src, size_t src_len,
+ void *dst, size_t *dst_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)src;
+ op.params[1].tmpref.size = src_len;
+
+ op.params[2].tmpref.buffer = dst;
+ op.params[2].tmpref.size = *dst_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_CIPHER_UPDATE, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *dst_len = op.params[2].tmpref.size;
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_cipher_do_final(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *src,
+ size_t src_len,
+ void *dst,
+ size_t *dst_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)src;
+ op.params[1].tmpref.size = src_len;
+
+ op.params[2].tmpref.buffer = (void *)dst;
+ op.params[2].tmpref.size = *dst_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_CIPHER_DO_FINAL, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *dst_len = op.params[2].tmpref.size;
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_random_number_generate(ADBG_Case_t *c,
+ TEEC_Session *s,
+ void *buf,
+ size_t blen)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].tmpref.buffer = buf;
+ op.params[0].tmpref.size = blen;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_RANDOM_NUMBER_GENEREATE, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ (void)ADBG_EXPECT_COMPARE_UNSIGNED(c, blen, ==,
+ op.params[0].tmpref.size);
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_ae_init(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *nonce, size_t nonce_len,
+ size_t tag_len, size_t aad_len,
+ size_t payload_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+ op.params[0].value.b = tag_len;
+
+ op.params[1].tmpref.buffer = (void *)nonce;
+ op.params[1].tmpref.size = nonce_len;
+
+ op.params[2].value.a = aad_len;
+ op.params[2].value.b = payload_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_VALUE_OUTPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_AE_INIT, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_ae_update_aad(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *aad, size_t aad_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)aad;
+ op.params[1].tmpref.size = aad_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_AE_UPDATE_AAD, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_ae_update(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *src,
+ size_t src_len,
+ void *dst,
+ size_t *dst_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)src;
+ op.params[1].tmpref.size = src_len;
+
+ op.params[2].tmpref.buffer = (void *)dst;
+ op.params[2].tmpref.size = *dst_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_AE_UPDATE, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *dst_len = op.params[2].tmpref.size;
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_ae_encrypt_final(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *src,
+ size_t src_len, void *dst,
+ size_t *dst_len, void *tag,
+ size_t *tag_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)src;
+ op.params[1].tmpref.size = src_len;
+
+ op.params[2].tmpref.buffer = (void *)dst;
+ op.params[2].tmpref.size = *dst_len;
+
+ op.params[3].tmpref.buffer = (void *)tag;
+ op.params[3].tmpref.size = *tag_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_MEMREF_TEMP_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_AE_ENCRYPT_FINAL, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS) {
+ *dst_len = op.params[2].tmpref.size;
+ *tag_len = op.params[3].tmpref.size;
+ }
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_ae_decrypt_final(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const void *src, size_t src_len,
+ void *dst, size_t *dst_len,
+ const void *tag, size_t tag_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = (void *)src;
+ op.params[1].tmpref.size = src_len;
+
+ op.params[2].tmpref.buffer = dst;
+ op.params[2].tmpref.size = *dst_len;
+
+ op.params[3].tmpref.buffer = (void *)tag;
+ op.params[3].tmpref.size = tag_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_MEMREF_TEMP_INPUT);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_AE_DECRYPT_FINAL, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *dst_len = op.params[2].tmpref.size;
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_asymmetric_operate(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ uint32_t cmd,
+ const TEE_Attribute *params,
+ uint32_t paramCount,
+ const void *src,
+ size_t src_len,
+ void *dst,
+ size_t *dst_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ uint8_t *buf;
+ size_t blen;
+
+ res = pack_attrs(params, paramCount, &buf, &blen);
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, res))
+ return res;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = buf;
+ op.params[1].tmpref.size = blen;
+
+ op.params[2].tmpref.buffer = (void *)src;
+ op.params[2].tmpref.size = src_len;
+
+ op.params[3].tmpref.buffer = dst;
+ op.params[3].tmpref.size = *dst_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT);
+
+ res = TEEC_InvokeCommand(s, cmd, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *dst_len = op.params[3].tmpref.size;
+
+ free(buf);
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_asymmetric_encrypt(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const TEE_Attribute *params,
+ uint32_t paramCount,
+ const void *src,
+ size_t src_len,
+ void *dst,
+ size_t *dst_len)
+{
+ return ta_crypt_cmd_asymmetric_operate(c, s, oph,
+ TA_CRYPT_CMD_ASYMMETRIC_ENCRYPT,
+ params, paramCount,
+ src, src_len, dst, dst_len);
+}
+
+static TEEC_Result ta_crypt_cmd_asymmetric_decrypt(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const TEE_Attribute *params,
+ uint32_t paramCount,
+ const void *src,
+ size_t src_len,
+ void *dst,
+ size_t *dst_len)
+{
+ return ta_crypt_cmd_asymmetric_operate(c, s, oph,
+ TA_CRYPT_CMD_ASYMMETRIC_DECRYPT,
+ params, paramCount,
+ src, src_len, dst, dst_len);
+}
+
+static TEEC_Result ta_crypt_cmd_asymmetric_sign(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const TEE_Attribute *params,
+ uint32_t paramCount,
+ const void *digest,
+ size_t digest_len,
+ void *signature,
+ size_t *signature_len)
+{
+ return ta_crypt_cmd_asymmetric_operate(c, s, oph,
+ TA_CRYPT_CMD_ASYMMETRIC_SIGN_DIGEST, params, paramCount,
+ digest, digest_len, signature, signature_len);
+}
+
+static TEEC_Result ta_crypt_cmd_asymmetric_verify(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ const TEE_Attribute *params,
+ uint32_t paramCount,
+ const void *digest,
+ size_t digest_len,
+ const void *signature,
+ size_t signature_len)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ uint8_t *buf;
+ size_t blen;
+
+ res = pack_attrs(params, paramCount, &buf, &blen);
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, res))
+ return res;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.params[1].tmpref.buffer = buf;
+ op.params[1].tmpref.size = blen;
+
+ op.params[2].tmpref.buffer = (void *)digest;
+ op.params[2].tmpref.size = digest_len;
+
+ op.params[3].tmpref.buffer = (void *)signature;
+ op.params[3].tmpref.size = signature_len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_INPUT,
+ TEEC_MEMREF_TEMP_INPUT);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_ASYMMETRIC_VERIFY_DIGEST,
+ &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ free(buf);
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_get_object_value_attribute(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectHandle o,
+ uint32_t attr_id,
+ uint32_t *valuea,
+ uint32_t *valueb)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)o <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)o;
+ op.params[0].value.b = attr_id;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_VALUE_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_GET_OBJECT_VALUE_ATTRIBUTE,
+ &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS) {
+ *valuea = op.params[1].value.a;
+ *valueb = op.params[1].value.b;
+ }
+
+ return res;
+}
+
+static TEEC_Result ta_crypt_cmd_generate_key(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectHandle o,
+ uint32_t key_size,
+ const TEE_Attribute *params,
+ uint32_t paramCount)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ uint8_t *buf;
+ size_t blen;
+
+ res = pack_attrs(params, paramCount, &buf, &blen);
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, res))
+ return res;
+
+ assert((uintptr_t)o <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)o;
+ op.params[0].value.b = key_size;
+
+ op.params[1].tmpref.buffer = buf;
+ op.params[1].tmpref.size = blen;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_GENERATE_KEY, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ free(buf);
+ return res;
+}
+
+static const uint8_t hash_data_md5_in1[] = {
+ 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'
+};
+
+static const uint8_t hash_data_md5_out1[] = {
+ 0x61, 0x12, 0x71, 0x83, 0x70, 0x8d, 0x3a, 0xc7,
+ 0xf1, 0x9b, 0x66, 0x06, 0xfc, 0xae, 0x7d, 0xf6
+};
+
+static const uint8_t hash_data_sha1_in1[] = {
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'
+};
+
+static const uint8_t hash_data_sha1_out1[] = {
+ 0x4b, 0x98, 0x92, 0xb6, 0x52, 0x72, 0x14, 0xaf,
+ 0xc6, 0x55, 0xb8, 0xaa, 0x52, 0xf4, 0xd2, 0x03,
+ 0xc1, 0x5e, 0x7c, 0x9c
+};
+
+static const uint8_t hash_data_sha224_in1[] = {
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'
+};
+
+static const uint8_t hash_data_sha224_out1[] = {
+ 0x08, 0x21, 0x69, 0xf9, 0x77, 0x1b, 0x80, 0x15,
+ 0xf3, 0x97, 0xae, 0xde, 0x5b, 0xba, 0xa2, 0x72,
+ 0x2d, 0x8f, 0x5c, 0x19, 0xfe, 0xd2, 0xe2, 0x68,
+ 0x92, 0x49, 0xd8, 0x44
+};
+
+static const uint8_t hash_data_sha256_in1[] = { 'a', 'b', 'c' };
+
+static const uint8_t hash_data_sha256_out1[] = {
+ 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
+ 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
+ 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
+ 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad
+};
+
+static const uint8_t hash_data_sha256_in2[] = { 'e', 'f', 'g' };
+
+static const uint8_t hash_data_sha256_out2[] = {
+ 0xd4, 0xff, 0xe8, 0xe9, 0xee, 0x0b, 0x48, 0xeb,
+ 0xa7, 0x16, 0x70, 0x61, 0x23, 0xa7, 0x18, 0x7f,
+ 0x32, 0xea, 0xe3, 0xbd, 0xcb, 0x0e, 0x77, 0x63,
+ 0xe4, 0x1e, 0x53, 0x32, 0x67, 0xbd, 0x8a, 0x53
+};
+
+
+static const uint8_t hash_data_sha384_in1[] = {
+ 'a', 'b', 'c', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'
+};
+
+static const uint8_t hash_data_sha384_out1[] = {
+ 0x4c, 0xab, 0x80, 0x9d, 0x96, 0x84, 0x01, 0x47,
+ 0x67, 0x0a, 0xc1, 0x7a, 0xb6, 0xb9, 0xf7, 0x6e,
+ 0x35, 0xa6, 0xb0, 0x8c, 0xf5, 0x2a, 0x3d, 0x64,
+ 0x9a, 0x8c, 0x7e, 0x0c, 0x55, 0x45, 0xd3, 0x7d,
+ 0x1f, 0x7f, 0x28, 0x34, 0x96, 0x14, 0x44, 0x2a,
+ 0xf5, 0x98, 0xa2, 0x95, 0x24, 0x76, 0x53, 0x97
+};
+
+static const uint8_t hash_data_sha512_in1[] = {
+ 'a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'
+};
+
+static const uint8_t hash_data_sha512_out1[] = {
+ 0x20, 0xd8, 0x64, 0x4f, 0x54, 0xa2, 0x5f, 0x6f,
+ 0x0a, 0xf9, 0xd5, 0x27, 0x7d, 0x17, 0xa8, 0x99,
+ 0x4c, 0x64, 0x3f, 0xd0, 0xf3, 0x83, 0x36, 0xee,
+ 0x93, 0x12, 0x55, 0xcd, 0x2e, 0x12, 0x34, 0xa0,
+ 0xc2, 0xaa, 0xf9, 0xbb, 0x15, 0xc5, 0xe9, 0xfa,
+ 0xf7, 0xa7, 0xda, 0xb8, 0x2f, 0x72, 0xa0, 0x47,
+ 0xe3, 0x02, 0x04, 0xe8, 0xa0, 0x35, 0x0c, 0x96,
+ 0x26, 0xd1, 0xcb, 0x8b, 0x47, 0x45, 0x25, 0xd0
+};
+
+struct xtest_hash_case {
+ uint32_t algo;
+ size_t in_incr;
+ const uint8_t *in;
+ size_t in_len;
+ const uint8_t *out;
+ size_t out_len;
+};
+
+#define XTEST_HASH_CASE(algo, in_incr, in, out) \
+ { (algo), (in_incr), (in), ARRAY_SIZE(in), (out), ARRAY_SIZE(out) }
+
+static const struct xtest_hash_case hash_cases[] = {
+ XTEST_HASH_CASE(TEE_ALG_MD5, 6, hash_data_md5_in1,
+ hash_data_md5_out1),
+ XTEST_HASH_CASE(TEE_ALG_SHA1, 3, hash_data_sha1_in1,
+ hash_data_sha1_out1),
+ XTEST_HASH_CASE(TEE_ALG_SHA224, 7, hash_data_sha224_in1,
+ hash_data_sha224_out1),
+ XTEST_HASH_CASE(TEE_ALG_SHA256, 1, hash_data_sha256_in1,
+ hash_data_sha256_out1),
+ XTEST_HASH_CASE(TEE_ALG_SHA256, 1, hash_data_sha256_in2,
+ hash_data_sha256_out2),
+ XTEST_HASH_CASE(TEE_ALG_SHA384, 1, hash_data_sha384_in1,
+ hash_data_sha384_out1),
+ XTEST_HASH_CASE(TEE_ALG_SHA512, 1, hash_data_sha512_in1,
+ hash_data_sha512_out1),
+};
+
+static void xtest_tee_test_4001(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+ size_t n;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+
+ for (n = 0; n < ARRAY_SIZE(hash_cases); n++) {
+ TEE_OperationHandle op1;
+ TEE_OperationHandle op2;
+ uint8_t out[64];
+ size_t out_size;
+
+ Do_ADBG_BeginSubCase(c, "Hash case %d algo 0x%x",
+ (int)n, (unsigned int)hash_cases[n].algo);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session, &op1,
+ hash_cases[n].algo,
+ TEE_MODE_DIGEST, 0)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session, &op2,
+ hash_cases[n].algo,
+ TEE_MODE_DIGEST, 0)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_digest_update(c, &session, op1,
+ hash_cases[n].in,
+ hash_cases[n].in_incr)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_copy_operation(c, &session, op2, op1)))
+ goto out;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_digest_do_final(c, &session, op2,
+ hash_cases[n].in + hash_cases[n].in_incr,
+ hash_cases[n].in_len - hash_cases[n].in_incr,
+ out, &out_size)))
+ goto out;
+
+ (void)ADBG_EXPECT_BUFFER(c, hash_cases[n].out,
+ hash_cases[n].out_len, out, out_size);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_reset_operation(c, &session, op1)))
+ goto out;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_digest_do_final(c, &session, op1,
+ hash_cases[n].in,
+ hash_cases[n].in_len, out,
+ &out_size)))
+ goto out;
+
+ (void)ADBG_EXPECT_BUFFER(c, hash_cases[n].out,
+ hash_cases[n].out_len, out, out_size);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op1)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op2)))
+ goto out;
+
+ Do_ADBG_EndSubCase(c, NULL);
+ }
+
+out:
+ TEEC_CloseSession(&session);
+}
+
+static const uint8_t mac_data_md5_key1[10] = {
+ 0x6B, 0x65, 0x79, /* key */
+};
+
+static const uint8_t mac_data_md5_in1[] = {
+ 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, /* The quic */
+ 0x6B, 0x20, 0x62, 0x72, 0x6F, 0x77, 0x6E, 0x20, /* k brown */
+ 0x66, 0x6F, 0x78, 0x20, 0x6A, 0x75, 0x6D, 0x70, /* fox jump */
+ 0x73, 0x20, 0x6F, 0x76, 0x65, 0x72, 0x20, 0x74, /* s over t */
+ 0x68, 0x65, 0x20, 0x6C, 0x61, 0x7A, 0x79, 0x20, /* he lazy */
+ 0x64, 0x6F, 0x67, /* dog */
+};
+
+static const uint8_t mac_data_md5_out1[] = {
+ 0x80, 0x07, 0x07, 0x13, 0x46, 0x3e, 0x77, 0x49,
+ 0xb9, 0x0c, 0x2d, 0xc2, 0x49, 0x11, 0xe2, 0x75
+};
+
+
+/* generated with scripts/digest_hmac.pl */
+static const uint8_t mac_data_sha1_key1[10] = {
+ 0x6B, 0x65, 0x79, /* key */
+};
+
+static const uint8_t mac_data_sha1_in1[] = {
+ 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, /* The quic */
+ 0x6B, 0x20, 0x62, 0x72, 0x6F, 0x77, 0x6E, 0x20, /* k brown */
+ 0x66, 0x6F, 0x78, 0x20, 0x6A, 0x75, 0x6D, 0x70, /* fox jump */
+ 0x73, 0x20, 0x6F, 0x76, 0x65, 0x72, 0x20, 0x74, /* s over t */
+ 0x68, 0x65, 0x20, 0x6C, 0x61, 0x7A, 0x79, 0x20, /* he lazy */
+ 0x64, 0x6F, 0x67, /* dog */
+};
+
+static const uint8_t mac_data_sha1_out1[] = {
+ 0xDE, 0x7C, 0x9B, 0x85, 0xB8, 0xB7, 0x8A, 0xA6, /* .|...... */
+ 0xBC, 0x8A, 0x7A, 0x36, 0xF7, 0x0A, 0x90, 0x70, /* ..z6...p */
+ 0x1C, 0x9D, 0xB4, 0xD9, /* .... */
+};
+
+static const uint8_t mac_data_sha224_key1[24] = {
+ 0x6B, 0x65, 0x79, /* key */
+};
+
+static const uint8_t mac_data_sha224_in1[] = {
+ 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, /* The quic */
+ 0x6B, 0x20, 0x62, 0x72, 0x6F, 0x77, 0x6E, 0x20, /* k brown */
+ 0x66, 0x6F, 0x78, 0x20, 0x6A, 0x75, 0x6D, 0x70, /* fox jump */
+ 0x73, 0x20, 0x6F, 0x76, 0x65, 0x72, 0x20, 0x74, /* s over t */
+ 0x68, 0x65, 0x20, 0x6C, 0x61, 0x7A, 0x79, 0x20, /* he lazy */
+ 0x64, 0x6F, 0x67, /* dog */
+};
+
+static const uint8_t mac_data_sha224_out1[] = {
+ 0x88, 0xFF, 0x8B, 0x54, 0x67, 0x5D, 0x39, 0xB8, /* ...Tg]9. */
+ 0xF7, 0x23, 0x22, 0xE6, 0x5F, 0xF9, 0x45, 0xC5, /* .#"._.E. */
+ 0x2D, 0x96, 0x37, 0x99, 0x88, 0xAD, 0xA2, 0x56, /* -.7....V */
+ 0x39, 0x74, 0x7E, 0x69, /* 9t~i */
+};
+
+
+static const uint8_t mac_data_sha256_key1[24] = {
+ 'Q', 'W', 'E', 'R', 'T', 'Y'
+};
+
+static const uint8_t mac_data_sha256_in1[] = { 'a', 'b', 'c' };
+
+static const uint8_t mac_data_sha256_out1[] = {
+ 0xee, 0x2e, 0x5d, 0x9b, 0x51, 0xe2, 0x9c, 0x1d,
+ 0x49, 0xe9, 0xae, 0x6f, 0x0a, 0xcc, 0x15, 0x18,
+ 0xde, 0x1e, 0xa3, 0x88, 0x8e, 0xee, 0x48, 0xbb,
+ 0x82, 0x77, 0xe9, 0x09, 0x74, 0x4b, 0xa2, 0xf2
+};
+
+/* generated with scripts/digest_hmac.pl */
+static const uint8_t mac_data_sha256_key2[24] = {
+ 0x6B, 0x65, 0x79, /* key */
+};
+
+static const uint8_t mac_data_sha256_in2[] = {
+ 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, /* The quic */
+ 0x6B, 0x20, 0x62, 0x72, 0x6F, 0x77, 0x6E, 0x20, /* k brown */
+ 0x66, 0x6F, 0x78, 0x20, 0x6A, 0x75, 0x6D, 0x70, /* fox jump */
+ 0x73, 0x20, 0x6F, 0x76, 0x65, 0x72, 0x20, 0x74, /* s over t */
+ 0x68, 0x65, 0x20, 0x6C, 0x61, 0x7A, 0x79, 0x20, /* he lazy */
+ 0x64, 0x6F, 0x67, /* dog */
+};
+
+static const uint8_t mac_data_sha256_out2[] = {
+ 0xF7, 0xBC, 0x83, 0xF4, 0x30, 0x53, 0x84, 0x24, /* ....0S.$ */
+ 0xB1, 0x32, 0x98, 0xE6, 0xAA, 0x6F, 0xB1, 0x43, /* .2...o.C */
+ 0xEF, 0x4D, 0x59, 0xA1, 0x49, 0x46, 0x17, 0x59, /* .MY.IF.Y */
+ 0x97, 0x47, 0x9D, 0xBC, 0x2D, 0x1A, 0x3C, 0xD8, /* .G..-.<. */
+};
+
+static const uint8_t mac_data_sha384_key1[32] = {
+ 0x6B, 0x65, 0x79, /* key */
+};
+
+static const uint8_t mac_data_sha384_in1[] = {
+ 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, /* The quic */
+ 0x6B, 0x20, 0x62, 0x72, 0x6F, 0x77, 0x6E, 0x20, /* k brown */
+ 0x66, 0x6F, 0x78, 0x20, 0x6A, 0x75, 0x6D, 0x70, /* fox jump */
+ 0x73, 0x20, 0x6F, 0x76, 0x65, 0x72, 0x20, 0x74, /* s over t */
+ 0x68, 0x65, 0x20, 0x6C, 0x61, 0x7A, 0x79, 0x20, /* he lazy */
+ 0x64, 0x6F, 0x67, /* dog */
+};
+
+static const uint8_t mac_data_sha384_out1[] = {
+ 0xD7, 0xF4, 0x72, 0x7E, 0x2C, 0x0B, 0x39, 0xAE, /* ..r~, .9. */
+ 0x0F, 0x1E, 0x40, 0xCC, 0x96, 0xF6, 0x02, 0x42, /* ..@....B */
+ 0xD5, 0xB7, 0x80, 0x18, 0x41, 0xCE, 0xA6, 0xFC, /* ....A... */
+ 0x59, 0x2C, 0x5D, 0x3E, 0x1A, 0xE5, 0x07, 0x00, /* Y, ]>.... */
+ 0x58, 0x2A, 0x96, 0xCF, 0x35, 0xE1, 0xE5, 0x54, /* X...5..T */
+ 0x99, 0x5F, 0xE4, 0xE0, 0x33, 0x81, 0xC2, 0x37, /* ._..3..7 */
+};
+
+static const uint8_t mac_data_sha512_key1[32] = {
+ 0x6B, 0x65, 0x79, /* key */
+};
+
+static const uint8_t mac_data_sha512_in1[] = {
+ 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, /* The quic */
+ 0x6B, 0x20, 0x62, 0x72, 0x6F, 0x77, 0x6E, 0x20, /* k brown */
+ 0x66, 0x6F, 0x78, 0x20, 0x6A, 0x75, 0x6D, 0x70, /* fox jump */
+ 0x73, 0x20, 0x6F, 0x76, 0x65, 0x72, 0x20, 0x74, /* s over t */
+ 0x68, 0x65, 0x20, 0x6C, 0x61, 0x7A, 0x79, 0x20, /* he lazy */
+ 0x64, 0x6F, 0x67, /* dog */
+};
+
+static const uint8_t mac_data_sha512_out1[] = {
+ 0xB4, 0x2A, 0xF0, 0x90, 0x57, 0xBA, 0xC1, 0xE2, /* ....W... */
+ 0xD4, 0x17, 0x08, 0xE4, 0x8A, 0x90, 0x2E, 0x09, /* ........ */
+ 0xB5, 0xFF, 0x7F, 0x12, 0xAB, 0x42, 0x8A, 0x4F, /* .....B.O */
+ 0xE8, 0x66, 0x53, 0xC7, 0x3D, 0xD2, 0x48, 0xFB, /* .fS.=.H. */
+ 0x82, 0xF9, 0x48, 0xA5, 0x49, 0xF7, 0xB7, 0x91, /* ..H.I... */
+ 0xA5, 0xB4, 0x19, 0x15, 0xEE, 0x4D, 0x1E, 0xC3, /* .....M.. */
+ 0x93, 0x53, 0x57, 0xE4, 0xE2, 0x31, 0x72, 0x50, /* .SW..1rP */
+ 0xD0, 0x37, 0x2A, 0xFA, 0x2E, 0xBE, 0xEB, 0x3A, /* .7.....: */
+};
+
+
+/* AES-CBC-MAC */
+static const uint8_t mac_cbc_vect1_key[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+};
+
+static const uint8_t mac_cbc_vect1_data[] = {
+ 0x43, 0x69, 0x70, 0x68, 0x65, 0x72, 0x20, 0x62, /* Cipher b */
+ 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x63, 0x68, 0x61, /* lock cha */
+ 0x69, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x28, 0x43, /* ining (C */
+ 0x42, 0x43, 0x29, 0x20, 0x69, 0x73, 0x20, 0x61, /* BC) is a */
+ 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x20, /* common */
+ 0x63, 0x68, 0x61, 0x69, 0x6E, 0x69, 0x6E, 0x67, /* chaining */
+ 0x20, 0x6D, 0x6F, 0x64, 0x65, 0x20, 0x69, 0x6E, /* mode in */
+ 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x74, /* which t */
+ 0x68, 0x65, 0x20, 0x70, 0x72, 0x65, 0x76, 0x69, /* he previ */
+ 0x6F, 0x75, 0x73, 0x20, 0x62, 0x6C, 0x6F, 0x63, /* ous bloc */
+ 0x6B, 0x27, 0x73, 0x20, 0x63, 0x69, 0x70, 0x68, /* k's ciph */
+ 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x20, 0x69, /* ertext i */
+ 0x73, 0x20, 0x78, 0x6F, 0x72, 0x65, 0x64, 0x20, /* s xored */
+ 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, /* with the */
+ 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x74, /* current */
+ 0x20, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x27, 0x73, /* block's */
+ 0x20, 0x70, 0x6C, 0x61, 0x69, 0x6E, 0x74, 0x65, /* plainte */
+ 0x78, 0x74, 0x20, 0x62, 0x65, 0x66, 0x6F, 0x72, /* xt befor */
+ 0x65, 0x20, 0x65, 0x6E, 0x63, 0x72, 0x79, 0x70, /* e encryp */
+ 0x74, 0x69, 0x6F, 0x6E, 0x2E, 0x2E, 0x2E, 0x2E, /* tion.... */
+};
+
+static const uint8_t mac_cbc_vect1_out[] = {
+ 0xC9, 0x6E, 0x83, 0x7E, 0x35, 0xC8, 0xA7, 0xA0, /* .n.~5... */
+ 0x33, 0xA3, 0xB1, 0x4B, 0x5A, 0x92, 0x51, 0x2E, /* 3..KZ.Q. */
+};
+
+/* DES-CBC-MAC */
+static const uint8_t mac_cbc_vect2_key[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+};
+
+#define mac_cbc_vect2_data mac_cbc_vect1_data
+static const uint8_t mac_cbc_vect2_out[] = {
+ 0xE9, 0x41, 0x46, 0x30, 0x69, 0x32, 0xBD, 0xD6, /* .AF0i2.. */
+};
+
+/* DES3-CBC-MAC */
+static const uint8_t mac_cbc_vect3_key[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, /* 12345678 */
+};
+
+#define mac_cbc_vect3_data mac_cbc_vect2_data
+static const uint8_t mac_cbc_vect3_out[] = {
+ 0x1C, 0x17, 0xB7, 0xB5, 0x9F, 0x54, 0x9C, 0x63, /* .....T.c */
+};
+
+/* AES-CBC-MAC PKCS#5 pad*/
+static const uint8_t mac_cbc_vect4_key[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+};
+
+#define mac_cbc_vect4_data mac_cbc_vect1_data
+static const uint8_t mac_cbc_vect4_out[] = {
+ 0x0B, 0x46, 0xC7, 0xA2, 0xE1, 0x5A, 0xE2, 0x23, /* .F...Z.# */
+ 0x83, 0x34, 0x1C, 0x86, 0x53, 0xF8, 0x51, 0x24, /* .4..S.Q$ */
+};
+
+/* DES-CBC-MAC PKCS#5 pad*/
+static const uint8_t mac_cbc_vect5_key[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+};
+
+#define mac_cbc_vect5_data mac_cbc_vect1_data
+static const uint8_t mac_cbc_vect5_out[] = {
+ 0x30, 0x81, 0x4F, 0x42, 0x03, 0x7E, 0xD8, 0xA9, /* 0.OB.~.. */
+};
+
+/* DES3-CBC-MAC PKCS#5 pad*/
+static const uint8_t mac_cbc_vect6_key[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, /* 12345678 */
+};
+
+#define mac_cbc_vect6_data mac_cbc_vect1_data
+static const uint8_t mac_cbc_vect6_out[] = {
+ 0x6E, 0x37, 0x6E, 0x14, 0x5E, 0x21, 0xDD, 0xF8, /* n7n.^!.. */
+};
+
+/* AES-CBC-MAC PKCS#5 pad*/
+#define mac_cbc_vect7_key mac_cbc_vect4_key
+static const uint8_t mac_cbc_vect7_data[] = {
+ 0x43, 0x69, 0x70, 0x68, 0x65, 0x72, 0x20, 0x62, /* Cipher b */
+ 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x63, 0x68, 0x61, /* lock cha */
+ 0x69, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x28, 0x43, /* ining (C */
+ 0x42, 0x43, 0x29, 0x20, 0x69, 0x73, 0x20, 0x61, /* BC) is a */
+ 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x20, /* common */
+ 0x63, 0x68, 0x61, 0x69, 0x6E, 0x69, 0x6E, 0x67, /* chaining */
+ 0x20, 0x6D, 0x6F, 0x64, 0x65, 0x20, 0x69, 0x6E, /* mode in */
+ 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x74, /* which t */
+ 0x68, 0x65, 0x20, 0x70, 0x72, 0x65, 0x76, 0x69, /* he previ */
+ 0x6F, 0x75, 0x73, 0x20, 0x62, 0x6C, 0x6F, 0x63, /* ous bloc */
+ 0x6B, 0x27, 0x73, 0x20, 0x63, 0x69, 0x70, 0x68, /* k's ciph */
+ 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x20, 0x69, /* ertext i */
+ 0x73, 0x20, 0x78, 0x6F, 0x72, 0x65, 0x64, 0x20, /* s xored */
+ 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, /* with the */
+ 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x74, /* current */
+ 0x20, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x27, 0x73, /* block's */
+ 0x20, 0x70, 0x6C, 0x61, 0x69, 0x6E, 0x74, 0x65, /* plainte */
+ 0x78, 0x74, 0x20, 0x62, 0x65, 0x66, 0x6F, 0x72, /* xt befor */
+ 0x65, 0x20, 0x65, 0x6E, 0x63, 0x72, 0x79, 0x70, /* e encryp */
+ 0x74, 0x69, 0x6F, 0x6E, 0x2E, /* tion. */
+};
+
+static const uint8_t mac_cbc_vect7_out[] = {
+ 0xFD, 0x89, 0x35, 0xB3, 0x93, 0x7F, 0xBB, 0xA2, /* ..5..... */
+ 0xFB, 0x65, 0x60, 0xC4, 0x0A, 0x62, 0xA0, 0xF9, /* .e`..b.. */
+};
+
+/* DES-CBC-MAC PKCS#5 pad*/
+#define mac_cbc_vect8_key mac_cbc_vect5_key
+#define mac_cbc_vect8_data mac_cbc_vect7_data
+static const uint8_t mac_cbc_vect8_out[] = {
+ 0x02, 0x2A, 0xA8, 0x2E, 0x47, 0xC6, 0xBB, 0x7C, /* ....G..| */
+};
+
+/* DES3-CBC-MAC PKCS#5 pad*/
+#define mac_cbc_vect9_key mac_cbc_vect6_key
+#define mac_cbc_vect9_data mac_cbc_vect7_data
+static const uint8_t mac_cbc_vect9_out[] = {
+ 0xD4, 0xF7, 0x3E, 0x27, 0x78, 0x0E, 0x1C, 0x79, /* ..>'x..y */
+};
+
+/*
+ * AES-CMAC
+ * Test vectors from
+ * http://csrc.nist.gov/publications/nistpubs/800-38B/SP_800-38B.pdf
+ */
+
+/* AES-128 */
+static const uint8_t mac_cmac_vect1_key[] = {
+ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
+ 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
+};
+
+static const uint8_t mac_cmac_vect1_out[] = {
+ 0xbb, 0x1d, 0x69, 0x29, 0xe9, 0x59, 0x37, 0x28,
+ 0x7f, 0xa3, 0x7d, 0x12, 0x9b, 0x75, 0x67, 0x46
+};
+
+#define mac_cmac_vect2_key mac_cmac_vect1_key
+static const uint8_t mac_cmac_vect2_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
+};
+
+static const uint8_t mac_cmac_vect2_out[] = {
+ 0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44,
+ 0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c
+};
+
+#define mac_cmac_vect3_key mac_cmac_vect1_key
+static const uint8_t mac_cmac_vect3_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11
+};
+
+static const uint8_t mac_cmac_vect3_out[] = {
+ 0xdf, 0xa6, 0x67, 0x47, 0xde, 0x9a, 0xe6, 0x30,
+ 0x30, 0xca, 0x32, 0x61, 0x14, 0x97, 0xc8, 0x27
+};
+
+#define mac_cmac_vect4_key mac_cmac_vect1_key
+static const uint8_t mac_cmac_vect4_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
+};
+
+static const uint8_t mac_cmac_vect4_out[] = {
+ 0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92,
+ 0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe
+};
+
+/* AES-192 */
+static const uint8_t mac_cmac_vect5_key[] = {
+ 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
+ 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
+ 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b
+};
+
+static const uint8_t mac_cmac_vect5_out[] = {
+ 0xd1, 0x7d, 0xdf, 0x46, 0xad, 0xaa, 0xcd, 0xe5,
+ 0x31, 0xca, 0xc4, 0x83, 0xde, 0x7a, 0x93, 0x67
+};
+
+
+#define mac_cmac_vect6_key mac_cmac_vect5_key
+static const uint8_t mac_cmac_vect6_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
+};
+
+static const uint8_t mac_cmac_vect6_out[] = {
+ 0x9e, 0x99, 0xa7, 0xbf, 0x31, 0xe7, 0x10, 0x90,
+ 0x06, 0x62, 0xf6, 0x5e, 0x61, 0x7c, 0x51, 0x84
+};
+
+#define mac_cmac_vect7_key mac_cmac_vect5_key
+static const uint8_t mac_cmac_vect7_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11
+};
+
+static const uint8_t mac_cmac_vect7_out[] = {
+ 0x8a, 0x1d, 0xe5, 0xbe, 0x2e, 0xb3, 0x1a, 0xad,
+ 0x08, 0x9a, 0x82, 0xe6, 0xee, 0x90, 0x8b, 0x0e
+};
+
+#define mac_cmac_vect8_key mac_cmac_vect5_key
+static const uint8_t mac_cmac_vect8_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
+};
+
+static const uint8_t mac_cmac_vect8_out[] = {
+ 0xa1, 0xd5, 0xdf, 0x0e, 0xed, 0x79, 0x0f, 0x79,
+ 0x4d, 0x77, 0x58, 0x96, 0x59, 0xf3, 0x9a, 0x11
+};
+
+/* AES-256 */
+static const uint8_t mac_cmac_vect9_key[] = {
+ 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
+ 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
+ 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
+ 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4
+};
+
+static const uint8_t mac_cmac_vect9_out[] = {
+ 0x02, 0x89, 0x62, 0xf6, 0x1b, 0x7b, 0xf8, 0x9e,
+ 0xfc, 0x6b, 0x55, 0x1f, 0x46, 0x67, 0xd9, 0x83
+};
+
+#define mac_cmac_vect10_key mac_cmac_vect9_key
+static const uint8_t mac_cmac_vect10_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
+};
+
+static const uint8_t mac_cmac_vect10_out[] = {
+ 0x28, 0xa7, 0x02, 0x3f, 0x45, 0x2e, 0x8f, 0x82,
+ 0xbd, 0x4b, 0xf2, 0x8d, 0x8c, 0x37, 0xc3, 0x5c
+};
+
+#define mac_cmac_vect11_key mac_cmac_vect9_key
+static const uint8_t mac_cmac_vect11_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11
+};
+
+static const uint8_t mac_cmac_vect11_out[] = {
+ 0xaa, 0xf3, 0xd8, 0xf1, 0xde, 0x56, 0x40, 0xc2,
+ 0x32, 0xf5, 0xb1, 0x69, 0xb9, 0xc9, 0x11, 0xe6
+};
+
+#define mac_cmac_vect12_key mac_cmac_vect9_key
+static const uint8_t mac_cmac_vect12_data[] = {
+ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10
+};
+
+static const uint8_t mac_cmac_vect12_out[] = {
+ 0xe1, 0x99, 0x21, 0x90, 0x54, 0x9f, 0x6e, 0xd5,
+ 0x69, 0x6a, 0x2c, 0x05, 0x6c, 0x31, 0x54, 0x10
+};
+
+struct xtest_mac_case {
+ uint32_t algo;
+ uint32_t key_type;
+ const uint8_t *key;
+ size_t key_len;
+ size_t in_incr;
+ const uint8_t *in;
+ size_t in_len;
+ const uint8_t *out;
+ size_t out_len;
+};
+
+#define XTEST_MAC_CASE(algo, key_type, key, in_incr, in, out) \
+ { (algo), (key_type), (key), ARRAY_SIZE(key), \
+ (in_incr), (in), ARRAY_SIZE(in), (out), ARRAY_SIZE(out) }
+
+#define XTEST_MAC_CBC_CASE(algo, key_type, vect, in_incr) \
+ XTEST_MAC_CASE((algo), (key_type), \
+ mac_cbc_ ## vect ## _key, (in_incr), \
+ mac_cbc_ ## vect ## _data, mac_cbc_ ## vect ## _out)
+
+#define XTEST_MAC_CMAC_CASE(vect, in_incr) \
+ XTEST_MAC_CASE(TEE_ALG_AES_CMAC, TEE_TYPE_AES, \
+ mac_cmac_ ## vect ## _key, (in_incr), \
+ mac_cmac_ ## vect ## _data, mac_cmac_ ## vect ## _out)
+
+static const struct xtest_mac_case mac_cases[] = {
+ XTEST_MAC_CASE(TEE_ALG_HMAC_MD5, TEE_TYPE_HMAC_MD5,
+ mac_data_md5_key1,
+ 4, mac_data_md5_in1, mac_data_md5_out1),
+ XTEST_MAC_CASE(TEE_ALG_HMAC_SHA1, TEE_TYPE_HMAC_SHA1,
+ mac_data_sha1_key1,
+ 5, mac_data_sha1_in1, mac_data_sha1_out1),
+ XTEST_MAC_CASE(TEE_ALG_HMAC_SHA224, TEE_TYPE_HMAC_SHA224,
+ mac_data_sha224_key1,
+ 8, mac_data_sha224_in1, mac_data_sha224_out1),
+ XTEST_MAC_CASE(TEE_ALG_HMAC_SHA256, TEE_TYPE_HMAC_SHA256,
+ mac_data_sha256_key1,
+ 1, mac_data_sha256_in1, mac_data_sha256_out1),
+ XTEST_MAC_CASE(TEE_ALG_HMAC_SHA256, TEE_TYPE_HMAC_SHA256,
+ mac_data_sha256_key2,
+ 7, mac_data_sha256_in2, mac_data_sha256_out2),
+ XTEST_MAC_CASE(TEE_ALG_HMAC_SHA384, TEE_TYPE_HMAC_SHA384,
+ mac_data_sha384_key1,
+ 11, mac_data_sha384_in1, mac_data_sha384_out1),
+ XTEST_MAC_CASE(TEE_ALG_HMAC_SHA512, TEE_TYPE_HMAC_SHA512,
+ mac_data_sha512_key1,
+ 13, mac_data_sha512_in1, mac_data_sha512_out1),
+
+ XTEST_MAC_CBC_CASE(TEE_ALG_AES_CBC_MAC_NOPAD, TEE_TYPE_AES, vect1, 14),
+ XTEST_MAC_CBC_CASE(TEE_ALG_DES_CBC_MAC_NOPAD, TEE_TYPE_DES, vect2, 16),
+ XTEST_MAC_CBC_CASE(TEE_ALG_DES3_CBC_MAC_NOPAD, TEE_TYPE_DES3, vect3,
+ 17),
+ XTEST_MAC_CBC_CASE(TEE_ALG_AES_CBC_MAC_PKCS5, TEE_TYPE_AES, vect4, 11),
+ XTEST_MAC_CBC_CASE(TEE_ALG_DES_CBC_MAC_PKCS5, TEE_TYPE_DES, vect5, 9),
+ XTEST_MAC_CBC_CASE(TEE_ALG_DES3_CBC_MAC_PKCS5, TEE_TYPE_DES3, vect6, 4),
+ XTEST_MAC_CBC_CASE(TEE_ALG_AES_CBC_MAC_PKCS5, TEE_TYPE_AES, vect7, 3),
+ XTEST_MAC_CBC_CASE(TEE_ALG_DES_CBC_MAC_PKCS5, TEE_TYPE_DES, vect8, 23),
+ XTEST_MAC_CBC_CASE(TEE_ALG_DES3_CBC_MAC_PKCS5, TEE_TYPE_DES3, vect9,
+ 34),
+
+ { TEE_ALG_AES_CMAC, TEE_TYPE_AES, mac_cmac_vect1_key,
+ ARRAY_SIZE(mac_cmac_vect1_key), 0, NULL, 0, mac_cmac_vect1_out,
+ ARRAY_SIZE(mac_cmac_vect1_out) },
+ XTEST_MAC_CMAC_CASE(vect2, 9),
+ XTEST_MAC_CMAC_CASE(vect3, 9),
+ XTEST_MAC_CMAC_CASE(vect4, 9),
+ { TEE_ALG_AES_CMAC, TEE_TYPE_AES, mac_cmac_vect5_key,
+ ARRAY_SIZE(mac_cmac_vect5_key), 0, NULL, 0, mac_cmac_vect5_out,
+ ARRAY_SIZE(mac_cmac_vect5_out) },
+ XTEST_MAC_CMAC_CASE(vect6, 9),
+ XTEST_MAC_CMAC_CASE(vect7, 9),
+ XTEST_MAC_CMAC_CASE(vect8, 9),
+ { TEE_ALG_AES_CMAC, TEE_TYPE_AES, mac_cmac_vect9_key,
+ ARRAY_SIZE(mac_cmac_vect9_key), 0, NULL, 0, mac_cmac_vect9_out,
+ ARRAY_SIZE(mac_cmac_vect9_out) },
+ XTEST_MAC_CMAC_CASE(vect10, 9),
+ XTEST_MAC_CMAC_CASE(vect11, 9),
+ XTEST_MAC_CMAC_CASE(vect12, 9),
+};
+
+static void xtest_tee_test_4002(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ TEE_OperationHandle op1;
+ TEE_OperationHandle op2;
+ TEE_ObjectHandle key_handle;
+ uint8_t out[64];
+ size_t out_size;
+ uint32_t ret_orig;
+ size_t n;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ for (n = 0; n < ARRAY_SIZE(mac_cases); n++) {
+ TEE_Attribute key_attr;
+ size_t key_size;
+
+ Do_ADBG_BeginSubCase(c, "MAC case %d algo 0x%x",
+ (int)n, (unsigned int)mac_cases[n].algo);
+
+ key_attr.attributeID = TEE_ATTR_SECRET_VALUE;
+ key_attr.content.ref.buffer = (void *)mac_cases[n].key;
+ key_attr.content.ref.length = mac_cases[n].key_len;
+
+ key_size = key_attr.content.ref.length * 8;
+ if (mac_cases[n].key_type == TEE_TYPE_DES ||
+ mac_cases[n].key_type == TEE_TYPE_DES3)
+ /* Exclude parity in bit size of key */
+ key_size -= key_size / 8;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session, &op1,
+ mac_cases[n].algo, TEE_MODE_MAC, key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session, &op2,
+ mac_cases[n].algo, TEE_MODE_MAC, key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, &session,
+ mac_cases[n].key_type, key_size, &key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, &session,
+ key_handle, &key_attr, 1)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op1,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_mac_init(c, &session, op1, NULL, 0)))
+ goto out;
+
+ if (mac_cases[n].in != NULL) {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_mac_update(c, &session, op1,
+ mac_cases[n].in, mac_cases[n].in_incr)))
+ goto out;
+ }
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_copy_operation(c, &session, op2, op1)))
+ goto out;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_mac_final_compute(c, &session, op2,
+ mac_cases[n].in + mac_cases[n].in_incr,
+ mac_cases [n].in_len - mac_cases[n].in_incr,
+ out, &out_size)))
+ goto out;
+
+ (void)ADBG_EXPECT_BUFFER(c, mac_cases[n].out,
+ mac_cases[n].out_len, out, out_size);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_mac_init(c, &session, op1, NULL, 0)))
+ goto out;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_mac_final_compute(c, &session, op1,
+ mac_cases[n].in, mac_cases[n].in_len, out,
+ &out_size)))
+ goto out;
+
+ (void)ADBG_EXPECT_BUFFER(c, mac_cases[n].out,
+ mac_cases[n].out_len, out, out_size);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op1)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op2)))
+ goto out;
+
+ Do_ADBG_EndSubCase(c, NULL);
+ }
+out:
+ TEEC_CloseSession(&session);
+}
+
+/* generated with scripts/crypt_aes_cbc_nopad.pl */
+static const uint8_t ciph_data_aes_key1[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+};
+
+static const uint8_t ciph_data_des_key1[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37 /* 01234567 */
+};
+
+static const uint8_t ciph_data_des_key2[] = {
+ 0x13, 0x34, 0x57, 0x79, 0x9B, 0xBC, 0xDF, 0xF1
+};
+
+
+static const uint8_t ciph_data_des3_key1[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, /* 12345678 */
+};
+
+static const uint8_t ciph_data_des3_key2[] = {
+ 0x13, 0x34, 0x57, 0x79, 0x9B, 0xBC, 0xDF, 0xF1,
+ 0x13, 0x34, 0x57, 0x79, 0x9B, 0xBC, 0xDF, 0xF1,
+ 0x13, 0x34, 0x57, 0x79, 0x9B, 0xBC, 0xDF, 0xF1
+};
+
+static const uint8_t ciph_data_des2_key1[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+};
+
+static const uint8_t ciph_data_in1[] = {
+ 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
+ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x30, 0x31, /* ABCDEF01 */
+ 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, /* 3456789A */
+ 0x42, 0x43, 0x44, 0x45, 0x46, 0x30, 0x31, 0x32, /* BCDEF012 */
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, /* 456789AB */
+ 0x43, 0x44, 0x45, 0x46, 0x30, 0x31, 0x32, 0x33, /* CDEF0123 */
+};
+
+static const uint8_t ciph_data_in3[] = {
+ 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
+ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x30, 0x31, /* ABCDEF01 */
+ 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, /* 3456789A */
+ 0x42, 0x43, 0x44, 0x45, 0x46, 0x30, 0x31, 0x32, /* BCDEF012 */
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, /* 456789AB */
+ 0x43, 0x44, 0x45, 0x46, 0x30, /* CDEF0 */
+};
+
+static const uint8_t ciph_data_128_iv1[] = {
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, /* 12345678 */
+ 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x30, /* 9ABCDEF0 */
+};
+
+static const uint8_t ciph_data_64_iv1[] = {
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, /* 12345678 */
+};
+
+static const uint8_t ciph_data_in2[] = {
+ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef
+};
+
+static const uint8_t ciph_data_aes_ecb_nopad_out1[] = {
+ 0xA5, 0xBE, 0x14, 0xD5, 0x01, 0x05, 0x24, 0x48, /* ......$H */
+ 0x58, 0x1A, 0x6B, 0x82, 0xD4, 0x41, 0xD2, 0xB3, /* X.k..A.. */
+ 0xBB, 0xF9, 0xAE, 0x37, 0x94, 0xAC, 0x18, 0x50, /* ...7...P */
+ 0x87, 0x09, 0xCC, 0x3F, 0x43, 0xD2, 0xC2, 0xB7, /* ...?C... */
+ 0xD7, 0x6F, 0x84, 0x07, 0xB4, 0x78, 0xCE, 0x34, /* .o...x.4 */
+ 0x48, 0xC9, 0x16, 0x86, 0x42, 0xB8, 0xFF, 0xCF, /* H...B... */
+};
+
+static const uint8_t ciph_data_aes_cbc_nopad_out1[] = {
+ 0x8D, 0x9F, 0x88, 0xD8, 0xAF, 0x9F, 0xC1, 0x3B, /* .......; */
+ 0x02, 0x15, 0x43, 0x6A, 0x8C, 0x1E, 0x34, 0x5C, /* ..Cj..4\ */
+ 0x83, 0xF4, 0x85, 0x3E, 0x43, 0x0F, 0xE5, 0x5F, /* ...>C.._ */
+ 0x81, 0x4C, 0xC0, 0x28, 0x3F, 0xD9, 0x98, 0x53, /* .L.(?..S */
+ 0xB1, 0x44, 0x51, 0x38, 0x21, 0xAB, 0x10, 0xCE, /* .DQ8!... */
+ 0xC2, 0xEC, 0x65, 0x54, 0xDD, 0x5C, 0xEA, 0xDC, /* ..eT.\.. */
+};
+
+static const uint8_t ciph_data_aes_ctr_out1[] = {
+ 0xD2, 0xDD, 0x11, 0xA8, 0xF7, 0xB0, 0xAE, 0x55, /* .......U */
+ 0xBE, 0x61, 0x7A, 0xE6, 0xA1, 0x6C, 0x79, 0xF4, /* .az..ly. */
+ 0x62, 0x51, 0x7B, 0xE9, 0x7C, 0xA0, 0x31, 0x0C, /* bQ{.|.1. */
+ 0x24, 0x15, 0x70, 0x7F, 0x47, 0x37, 0x69, 0xE0, /* $.p.G7i. */
+ 0x24, 0xC3, 0x29, 0xCD, 0xF2, 0x26, 0x69, 0xFF, /* $.)..&i. */
+ 0x72, 0x0E, 0x3C, 0xD1, 0xA1, 0x2F, 0x5D, 0x33, /* r.<../]3 */
+};
+
+static const uint8_t ciph_data_aes_ctr_out2[] = {
+ 0xD2, 0xDD, 0x11, 0xA8, 0xF7, 0xB0, 0xAE, 0x55, /* .......U */
+ 0xBE, 0x61, 0x7A, 0xE6, 0xA1, 0x6C, 0x79, 0xF4, /* .az..ly. */
+ 0x62, 0x51, 0x7B, 0xE9, 0x7C, 0xA0, 0x31, 0x0C, /* bQ{.|.1. */
+ 0x24, 0x15, 0x70, 0x7F, 0x47, 0x37, 0x69, 0xE0, /* $.p.G7i. */
+ 0x24, 0xC3, 0x29, 0xCD, 0xF2, 0x26, 0x69, 0xFF, /* $.)..&i. */
+ 0x72, 0x0E, 0x3C, 0xD1, 0xA1, /* r.<.. */
+};
+
+static const uint8_t ciph_data_aes_cbc_vect1_key[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
+ 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */
+};
+
+static const uint8_t ciph_data_aes_cbc_vect1_iv[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
+};
+
+static const uint8_t ciph_data_aes_cbc_vect1_ptx[] = {
+ 0x43, 0x69, 0x70, 0x68, 0x65, 0x72, 0x20, 0x62, /* Cipher b */
+ 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x63, 0x68, 0x61, /* lock cha */
+ 0x69, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x28, 0x43, /* ining (C */
+ 0x42, 0x43, 0x29, 0x20, 0x69, 0x73, 0x20, 0x61, /* BC) is a */
+ 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x6F, 0x6E, 0x20, /* common */
+ 0x63, 0x68, 0x61, 0x69, 0x6E, 0x69, 0x6E, 0x67, /* chaining */
+ 0x20, 0x6D, 0x6F, 0x64, 0x65, 0x20, 0x69, 0x6E, /* mode in */
+ 0x20, 0x77, 0x68, 0x69, 0x63, 0x68, 0x20, 0x74, /* which t */
+ 0x68, 0x65, 0x20, 0x70, 0x72, 0x65, 0x76, 0x69, /* he previ */
+ 0x6F, 0x75, 0x73, 0x20, 0x62, 0x6C, 0x6F, 0x63, /* ous bloc */
+ 0x6B, 0x27, 0x73, 0x20, 0x63, 0x69, 0x70, 0x68, /* k's ciph */
+ 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x20, 0x69, /* ertext i */
+ 0x73, 0x20, 0x78, 0x6F, 0x72, 0x65, 0x64, 0x20, /* s xored */
+ 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, /* with the */
+ 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x74, /* current */
+ 0x20, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x27, 0x73, /* block's */
+ 0x20, 0x70, 0x6C, 0x61, 0x69, 0x6E, 0x74, 0x65, /* plainte */
+ 0x78, 0x74, 0x20, 0x62, 0x65, 0x66, 0x6F, 0x72, /* xt befor */
+ 0x65, 0x20, 0x65, 0x6E, 0x63, 0x72, 0x79, 0x70, /* e encryp */
+ 0x74, 0x69, 0x6F, 0x6E, 0x2E, 0x2E, 0x2E, 0x2E, /* tion.... */
+};
+
+static const uint8_t ciph_data_aes_cbc_vect1_ctx[] = {
+ 0xDD, 0x16, 0xC3, 0x47, 0x69, 0xEC, 0xF5, 0x86, /* ...Gi... */
+ 0x20, 0xB4, 0xF7, 0xE3, 0xB9, 0x36, 0xE8, 0xAC, /* ....6.. */
+ 0xC9, 0xA2, 0x11, 0x71, 0x3B, 0x10, 0x9D, 0x45, /* ...q;..E */
+ 0xCA, 0xE2, 0x49, 0xA6, 0x4E, 0x56, 0x07, 0xC5, /* ..I.NV.. */
+ 0xCE, 0xA3, 0x14, 0xB5, 0x30, 0x1B, 0x63, 0xBB, /* ....0.c. */
+ 0x2D, 0x6F, 0xE9, 0xCA, 0x0B, 0x00, 0x31, 0x3F, /* -o....1? */
+ 0xA4, 0x9A, 0x39, 0xE1, 0xC8, 0xD2, 0x24, 0x95, /* ..9...$. */
+ 0x14, 0xE9, 0xD2, 0x43, 0xE8, 0xA8, 0x1E, 0x0A, /* ...C.... */
+ 0xFE, 0x9D, 0x4F, 0xF5, 0xBB, 0x16, 0xB9, 0x54, /* ..O....T */
+ 0x78, 0x07, 0x94, 0x05, 0x8E, 0x47, 0xC3, 0xCB, /* x....G.. */
+ 0x7C, 0xEC, 0xF4, 0xF8, 0xF2, 0xA4, 0x59, 0x6E, /* |.....Yn */
+ 0xED, 0xAD, 0x7F, 0x62, 0xAF, 0x89, 0xA8, 0x5B, /* ...b...[ */
+ 0x75, 0xD4, 0x73, 0xE3, 0xBA, 0x9F, 0x9A, 0xD2, /* u.s..... */
+ 0x0F, 0xFD, 0x3C, 0xE6, 0xC6, 0xA4, 0xD6, 0x6C, /* ..<....l */
+ 0x6A, 0x09, 0xE2, 0x16, 0xB0, 0x8C, 0x69, 0x3C, /* j.....i< */
+ 0xC8, 0x1C, 0xE4, 0x3E, 0x86, 0x4D, 0xB0, 0x2B, /* ...>.M.+ */
+ 0x29, 0xA0, 0x5A, 0xA3, 0x67, 0xBA, 0xDC, 0x11, /* ).Z.g... */
+ 0x08, 0x5E, 0x69, 0xB4, 0x6F, 0xA5, 0xE2, 0xB8, /* .^i.o... */
+ 0xC9, 0x6E, 0x83, 0x7E, 0x35, 0xC8, 0xA7, 0xA0, /* .n.~5... */
+ 0x33, 0xA3, 0xB1, 0x4B, 0x5A, 0x92, 0x51, 0x2E, /* 3..KZ.Q. */
+};
+
+/* AES-CTS test vectors from http://tools.ietf.org/html/rfc3962
+ * and http://tools.ietf.org/html/draft-raeburn-krb-rijndael-krb-02 */
+static const uint8_t ciph_data_aes_cts_vect1_key[] = {
+ 0x63, 0x68, 0x69, 0x63, 0x6b, 0x65, 0x6e, 0x20,
+ 0x74, 0x65, 0x72, 0x69, 0x79, 0x61, 0x6b, 0x69
+};
+
+static const uint8_t ciph_data_aes_cts_vect1_iv[16] = {
+ 0x00
+};
+
+static const uint8_t ciph_data_aes_cts_vect1_ptx[] = {
+ 0x49, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20,
+ 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65,
+ 0x20
+};
+
+static const uint8_t ciph_data_aes_cts_vect1_ctx[] = {
+ 0xc6, 0x35, 0x35, 0x68, 0xf2, 0xbf, 0x8c, 0xb4,
+ 0xd8, 0xa5, 0x80, 0x36, 0x2d, 0xa7, 0xff, 0x7f,
+ 0x97
+};
+
+#define ciph_data_aes_cts_vect2_key ciph_data_aes_cts_vect1_key
+#define ciph_data_aes_cts_vect2_iv ciph_data_aes_cts_vect1_iv
+static const uint8_t ciph_data_aes_cts_vect2_ptx[] = {
+ 0x49, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20,
+ 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+ 0x20, 0x47, 0x61, 0x75, 0x27, 0x73, 0x20
+};
+
+static const uint8_t ciph_data_aes_cts_vect2_ctx[] = {
+ 0xfc, 0x00, 0x78, 0x3e, 0x0e, 0xfd, 0xb2, 0xc1,
+ 0xd4, 0x45, 0xd4, 0xc8, 0xef, 0xf7, 0xed, 0x22,
+ 0x97, 0x68, 0x72, 0x68, 0xd6, 0xec, 0xcc, 0xc0,
+ 0xc0, 0x7b, 0x25, 0xe2, 0x5e, 0xcf, 0xe5
+};
+
+#define ciph_data_aes_cts_vect3_key ciph_data_aes_cts_vect1_key
+#define ciph_data_aes_cts_vect3_iv ciph_data_aes_cts_vect1_iv
+static const uint8_t ciph_data_aes_cts_vect3_ptx[] = {
+ 0x49, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20,
+ 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+ 0x20, 0x47, 0x61, 0x75, 0x27, 0x73, 0x20, 0x43,
+};
+
+static const uint8_t ciph_data_aes_cts_vect3_ctx[] = {
+ 0x39, 0x31, 0x25, 0x23, 0xa7, 0x86, 0x62, 0xd5,
+ 0xbe, 0x7f, 0xcb, 0xcc, 0x98, 0xeb, 0xf5, 0xa8,
+ 0x97, 0x68, 0x72, 0x68, 0xd6, 0xec, 0xcc, 0xc0,
+ 0xc0, 0x7b, 0x25, 0xe2, 0x5e, 0xcf, 0xe5, 0x84,
+};
+
+#define ciph_data_aes_cts_vect4_key ciph_data_aes_cts_vect1_key
+#define ciph_data_aes_cts_vect4_iv ciph_data_aes_cts_vect1_iv
+static const uint8_t ciph_data_aes_cts_vect4_ptx[] = {
+ 0x49, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20,
+ 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+ 0x20, 0x47, 0x61, 0x75, 0x27, 0x73, 0x20, 0x43,
+ 0x68, 0x69, 0x63, 0x6b, 0x65, 0x6e, 0x2c, 0x20,
+ 0x70, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2c,
+};
+
+static const uint8_t ciph_data_aes_cts_vect4_ctx[] = {
+ 0x97, 0x68, 0x72, 0x68, 0xd6, 0xec, 0xcc, 0xc0,
+ 0xc0, 0x7b, 0x25, 0xe2, 0x5e, 0xcf, 0xe5, 0x84,
+ 0xb3, 0xff, 0xfd, 0x94, 0x0c, 0x16, 0xa1, 0x8c,
+ 0x1b, 0x55, 0x49, 0xd2, 0xf8, 0x38, 0x02, 0x9e,
+ 0x39, 0x31, 0x25, 0x23, 0xa7, 0x86, 0x62, 0xd5,
+ 0xbe, 0x7f, 0xcb, 0xcc, 0x98, 0xeb, 0xf5,
+};
+
+#define ciph_data_aes_cts_vect5_key ciph_data_aes_cts_vect1_key
+#define ciph_data_aes_cts_vect5_iv ciph_data_aes_cts_vect1_iv
+static const uint8_t ciph_data_aes_cts_vect5_ptx[] = {
+ 0x49, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20,
+ 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+ 0x20, 0x47, 0x61, 0x75, 0x27, 0x73, 0x20, 0x43,
+ 0x68, 0x69, 0x63, 0x6b, 0x65, 0x6e, 0x2c, 0x20,
+ 0x70, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2c, 0x20,
+};
+
+static const uint8_t ciph_data_aes_cts_vect5_ctx[] = {
+ 0x97, 0x68, 0x72, 0x68, 0xd6, 0xec, 0xcc, 0xc0,
+ 0xc0, 0x7b, 0x25, 0xe2, 0x5e, 0xcf, 0xe5, 0x84,
+ 0x9d, 0xad, 0x8b, 0xbb, 0x96, 0xc4, 0xcd, 0xc0,
+ 0x3b, 0xc1, 0x03, 0xe1, 0xa1, 0x94, 0xbb, 0xd8,
+ 0x39, 0x31, 0x25, 0x23, 0xa7, 0x86, 0x62, 0xd5,
+ 0xbe, 0x7f, 0xcb, 0xcc, 0x98, 0xeb, 0xf5, 0xa8,
+};
+
+#define ciph_data_aes_cts_vect6_key ciph_data_aes_cts_vect1_key
+#define ciph_data_aes_cts_vect6_iv ciph_data_aes_cts_vect1_iv
+static const uint8_t ciph_data_aes_cts_vect6_ptx[] = {
+ 0x49, 0x20, 0x77, 0x6f, 0x75, 0x6c, 0x64, 0x20,
+ 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x74, 0x68, 0x65,
+ 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
+ 0x20, 0x47, 0x61, 0x75, 0x27, 0x73, 0x20, 0x43,
+ 0x68, 0x69, 0x63, 0x6b, 0x65, 0x6e, 0x2c, 0x20,
+ 0x70, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2c, 0x20,
+ 0x61, 0x6e, 0x64, 0x20, 0x77, 0x6f, 0x6e, 0x74,
+ 0x6f, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x70, 0x2e,
+};
+
+static const uint8_t ciph_data_aes_cts_vect6_ctx[] = {
+ 0x97, 0x68, 0x72, 0x68, 0xd6, 0xec, 0xcc, 0xc0,
+ 0xc0, 0x7b, 0x25, 0xe2, 0x5e, 0xcf, 0xe5, 0x84,
+ 0x39, 0x31, 0x25, 0x23, 0xa7, 0x86, 0x62, 0xd5,
+ 0xbe, 0x7f, 0xcb, 0xcc, 0x98, 0xeb, 0xf5, 0xa8,
+ 0x48, 0x07, 0xef, 0xe8, 0x36, 0xee, 0x89, 0xa5,
+ 0x26, 0x73, 0x0d, 0xbc, 0x2f, 0x7b, 0xc8, 0x40,
+ 0x9d, 0xad, 0x8b, 0xbb, 0x96, 0xc4, 0xcd, 0xc0,
+ 0x3b, 0xc1, 0x03, 0xe1, 0xa1, 0x94, 0xbb, 0xd8,
+};
+
+static const uint8_t ciph_data_des_ecb_nopad_out1[] = {
+ 0x46, 0x2B, 0x91, 0xA8, 0x55, 0xE6, 0x7E, 0x75, /* F+..U.~u */
+ 0x5E, 0x53, 0xF4, 0x8F, 0x29, 0x41, 0x4E, 0xEF, /* ^S..)AN. */
+ 0x32, 0x1B, 0x58, 0x42, 0x9B, 0xB4, 0x3A, 0x1F, /* 2.XB..:. */
+ 0x9A, 0xEA, 0xA4, 0xB4, 0xCD, 0xE9, 0x87, 0x7C, /* .......| */
+ 0xC0, 0x05, 0x34, 0xED, 0x86, 0x3C, 0x2A, 0x81, /* ..4..<.. */
+ 0x5E, 0x93, 0x0E, 0x86, 0xA9, 0xBB, 0x80, 0xFF, /* ^....... */
+};
+
+static const uint8_t ciph_data_des_ecb_nopad_out2[] = {
+ 0x85, 0xE8, 0x13, 0x54, 0x0F, 0x0A, 0xB4, 0x05
+};
+
+static const uint8_t ciph_data_des_cbc_nopad_out1[] = {
+ 0xAD, 0xD6, 0xD6, 0x3E, 0x88, 0xD0, 0xDD, 0xD4, /* ...>.... */
+ 0x9A, 0x93, 0x95, 0xA0, 0x86, 0x22, 0x5B, 0x9E, /* ....."[. */
+ 0x84, 0x0C, 0x6F, 0x12, 0x04, 0x11, 0x6F, 0xD4, /* ..o...o. */
+ 0x12, 0x29, 0xC6, 0x78, 0x0C, 0xFB, 0x58, 0x5B, /* .).x..X[ */
+ 0x66, 0x82, 0x0E, 0x52, 0xDC, 0x25, 0x16, 0x51, /* f..R.%.Q */
+ 0x69, 0xDF, 0xFE, 0x4E, 0x11, 0x1D, 0x9D, 0x08, /* i..N.... */
+};
+
+static const uint8_t ciph_data_des3_ecb_nopad_out1[] = {
+ 0xA7, 0x46, 0xEC, 0xA8, 0x6A, 0x7F, 0x4A, 0xF1, /* .F..j.J. */
+ 0x44, 0x60, 0x37, 0x3B, 0x7F, 0x76, 0xE5, 0xFF, /* D`7;.v.. */
+ 0xC1, 0xE7, 0xA5, 0x04, 0x9C, 0x29, 0x5C, 0xA5, /* .....)\. */
+ 0xDD, 0xC8, 0xEE, 0x36, 0x1F, 0x48, 0xE0, 0xA9, /* ...6.H.. */
+ 0x82, 0x2D, 0x53, 0x84, 0x49, 0x69, 0x78, 0xFA, /* .-S.Iix. */
+ 0x23, 0x69, 0x1D, 0xF7, 0x08, 0x38, 0x44, 0x05, /* #i...8D. */
+};
+
+static const uint8_t ciph_data_des3_cbc_nopad_out1[] = {
+ 0x18, 0x09, 0xEB, 0x98, 0xE4, 0x58, 0x72, 0x11, /* .....Xr. */
+ 0x30, 0x58, 0xAB, 0x38, 0xB0, 0xC9, 0x2B, 0xED, /* 0X.8..+. */
+ 0xDA, 0xC5, 0xE8, 0xA9, 0xF6, 0x8A, 0xA7, 0x80, /* ........ */
+ 0xBE, 0x54, 0x1F, 0x63, 0xF6, 0xEE, 0xA2, 0x4C, /* .T.c...L */
+ 0x7C, 0xEB, 0x84, 0x7D, 0xDA, 0xCA, 0x1E, 0xB2, /* |..}.... */
+ 0xED, 0x5E, 0x96, 0xB8, 0x01, 0x4B, 0x77, 0x02, /* .^...Kw. */
+};
+
+static const uint8_t ciph_data_des2_ecb_nopad_out1[] = {
+ 0xAB, 0x12, 0xB6, 0xE2, 0x4A, 0x3A, 0x26, 0x14, /* ....J:&. */
+ 0xF0, 0x7D, 0x23, 0xD0, 0x55, 0xDF, 0x5C, 0x16, /* .}#.U.\. */
+ 0x43, 0x59, 0x1E, 0x44, 0x01, 0x76, 0xD7, 0x50, /* CY.D.v.P */
+ 0x44, 0xC0, 0x15, 0xDF, 0x2E, 0x7F, 0x8B, 0xC5, /* D....... */
+ 0xFF, 0x8B, 0x87, 0xFE, 0x33, 0xD7, 0xCB, 0x2C, /* ....3.., */
+ 0xDA, 0x79, 0x6F, 0xA4, 0x05, 0x2B, 0x30, 0xCE, /* .yo..+0. */
+};
+
+static const uint8_t ciph_data_des2_cbc_nopad_out1[] = {
+ 0x47, 0x2F, 0xB1, 0x83, 0xC4, 0xBB, 0x93, 0x16, /* G/...... */
+ 0x73, 0xF9, 0xAD, 0x6F, 0x00, 0xF9, 0xCB, 0x4A, /* s..o...J */
+ 0x0F, 0x4F, 0x75, 0x75, 0xFB, 0x39, 0x0B, 0xFC, /* .Ouu.9.. */
+ 0x9F, 0x48, 0x52, 0xAD, 0xA2, 0x75, 0x2C, 0xF1, /* .HR..u, . */
+ 0x7D, 0xC3, 0x8F, 0x16, 0xCF, 0xC9, 0x76, 0x29, /* }.....v) */
+ 0x1A, 0xBF, 0xB3, 0xD9, 0x10, 0x7E, 0xAA, 0x49, /* .....~.I */
+};
+
+struct xtest_ciph_case {
+ uint32_t algo;
+ uint32_t mode;
+ uint32_t key_type;
+ const uint8_t *key1;
+ size_t key1_len;
+ const uint8_t *key2;
+ size_t key2_len;
+ const uint8_t *iv;
+ size_t iv_len;
+ size_t in_incr;
+ const uint8_t *in;
+ size_t in_len;
+ const uint8_t *out;
+ size_t out_len;
+ size_t line;
+};
+
+#define XTEST_CIPH_CASE_NO_IV(algo, key_type, key, in_incr, ptx, ctx) \
+ { (algo), TEE_MODE_ENCRYPT, (key_type), (key), ARRAY_SIZE(key), \
+ NULL, 0, NULL, 0, \
+ (in_incr), (ptx), ARRAY_SIZE(ptx), (ctx), ARRAY_SIZE(ctx), \
+ __LINE__ }, \
+ { (algo), TEE_MODE_DECRYPT, (key_type), (key), ARRAY_SIZE(key), \
+ NULL, 0, NULL, 0, \
+ (in_incr), (ctx), ARRAY_SIZE(ctx), (ptx), ARRAY_SIZE(ptx), __LINE__ }
+
+#define XTEST_CIPH_CASE(algo, key_type, key, iv, in_incr, ptx, ctx) \
+ { (algo), TEE_MODE_ENCRYPT, (key_type), (key), ARRAY_SIZE(key), \
+ NULL, 0, iv, ARRAY_SIZE(iv), (in_incr), (ptx), ARRAY_SIZE(ptx), \
+ (ctx), ARRAY_SIZE(ctx), __LINE__ }, \
+ { (algo), TEE_MODE_DECRYPT, (key_type), (key), ARRAY_SIZE(key), \
+ NULL, 0, iv, ARRAY_SIZE(iv), (in_incr), (ctx), ARRAY_SIZE(ctx), \
+ (ptx), ARRAY_SIZE(ptx), __LINE__ }
+
+#define XTEST_CIPH_CASE_AES_XTS(vect, in_incr) \
+ { TEE_ALG_AES_XTS, TEE_MODE_ENCRYPT, TEE_TYPE_AES, \
+ ciph_data_aes_xts_ ## vect ## _key1, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _key1), \
+ ciph_data_aes_xts_ ## vect ## _key2, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _key2), \
+ ciph_data_aes_xts_ ## vect ## _iv, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _iv), \
+ (in_incr), \
+ ciph_data_aes_xts_ ## vect ## _ptx, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _ptx), \
+ ciph_data_aes_xts_ ## vect ## _ctx, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _ctx), __LINE__ }, \
+ { TEE_ALG_AES_XTS, TEE_MODE_DECRYPT, TEE_TYPE_AES, \
+ ciph_data_aes_xts_ ## vect ## _key1, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _key1), \
+ ciph_data_aes_xts_ ## vect ## _key2, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _key2), \
+ ciph_data_aes_xts_ ## vect ## _iv, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _iv), \
+ (in_incr), \
+ ciph_data_aes_xts_ ## vect ## _ctx, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _ctx), \
+ ciph_data_aes_xts_ ## vect ## _ptx, \
+ ARRAY_SIZE(ciph_data_aes_xts_ ## vect ## _ptx), __LINE__ }
+
+#define XTEST_CIPH_CASE_AES_CBC(vect, in_incr) \
+ XTEST_CIPH_CASE(TEE_ALG_AES_CBC_NOPAD, TEE_TYPE_AES, \
+ ciph_data_aes_cbc_ ## vect ## _key, \
+ ciph_data_aes_cbc_ ## vect ## _iv, \
+ (in_incr), ciph_data_aes_cbc_ ## vect ## _ptx, \
+ ciph_data_aes_cbc_ ## vect ## _ctx)
+
+#define XTEST_CIPH_CASE_AES_CTS(vect, in_incr) \
+ XTEST_CIPH_CASE(TEE_ALG_AES_CTS, TEE_TYPE_AES, \
+ ciph_data_aes_cts_ ## vect ## _key, \
+ ciph_data_aes_cts_ ## vect ## _iv, \
+ (in_incr), ciph_data_aes_cts_ ## vect ## _ptx, \
+ ciph_data_aes_cts_ ## vect ## _ctx)
+
+static const struct xtest_ciph_case ciph_cases[] = {
+ /* AES */
+ XTEST_CIPH_CASE_NO_IV(TEE_ALG_AES_ECB_NOPAD, TEE_TYPE_AES,
+ ciph_data_aes_key1, 11, ciph_data_in1,
+ ciph_data_aes_ecb_nopad_out1),
+ XTEST_CIPH_CASE(TEE_ALG_AES_CBC_NOPAD, TEE_TYPE_AES,
+ ciph_data_aes_key1, ciph_data_128_iv1, 11,
+ ciph_data_in1,
+ ciph_data_aes_cbc_nopad_out1),
+ XTEST_CIPH_CASE(TEE_ALG_AES_CTR, TEE_TYPE_AES,
+ ciph_data_aes_key1, ciph_data_128_iv1, 13,
+ ciph_data_in1,
+ ciph_data_aes_ctr_out1),
+ XTEST_CIPH_CASE(TEE_ALG_AES_CTR, TEE_TYPE_AES,
+ ciph_data_aes_key1, ciph_data_128_iv1, 13,
+ ciph_data_in3,
+ ciph_data_aes_ctr_out2),
+
+ XTEST_CIPH_CASE_AES_CBC(vect1, 11),
+
+ /* AES-CTS */
+ XTEST_CIPH_CASE_AES_CTS(vect1, 13),
+ XTEST_CIPH_CASE_AES_CTS(vect2, 14),
+ XTEST_CIPH_CASE_AES_CTS(vect3, 11),
+ XTEST_CIPH_CASE_AES_CTS(vect4, 9),
+ XTEST_CIPH_CASE_AES_CTS(vect5, 7),
+ XTEST_CIPH_CASE_AES_CTS(vect6, 17),
+ XTEST_CIPH_CASE_AES_CTS(vect6, 0x20),
+
+ /* DES */
+ XTEST_CIPH_CASE_NO_IV(TEE_ALG_DES_ECB_NOPAD, TEE_TYPE_DES,
+ ciph_data_des_key1, 14, ciph_data_in1,
+ ciph_data_des_ecb_nopad_out1),
+ XTEST_CIPH_CASE_NO_IV(TEE_ALG_DES_ECB_NOPAD, TEE_TYPE_DES,
+ ciph_data_des_key2, 3, ciph_data_in2,
+ ciph_data_des_ecb_nopad_out2),
+ XTEST_CIPH_CASE(TEE_ALG_DES_CBC_NOPAD, TEE_TYPE_DES,
+ ciph_data_des_key1, ciph_data_64_iv1, 15, ciph_data_in1,
+ ciph_data_des_cbc_nopad_out1),
+
+ /* DES3 */
+ XTEST_CIPH_CASE_NO_IV(TEE_ALG_DES3_ECB_NOPAD, TEE_TYPE_DES3,
+ ciph_data_des3_key1, 11, ciph_data_in1,
+ ciph_data_des3_ecb_nopad_out1),
+ XTEST_CIPH_CASE_NO_IV(TEE_ALG_DES3_ECB_NOPAD, TEE_TYPE_DES3,
+ ciph_data_des3_key2, 3, ciph_data_in2,
+ ciph_data_des_ecb_nopad_out2),
+ XTEST_CIPH_CASE(TEE_ALG_DES3_CBC_NOPAD, TEE_TYPE_DES3,
+ ciph_data_des3_key1, ciph_data_64_iv1, 11,
+ ciph_data_in1,
+ ciph_data_des3_cbc_nopad_out1),
+
+ /* DES2 */
+ XTEST_CIPH_CASE_NO_IV(TEE_ALG_DES3_ECB_NOPAD, TEE_TYPE_DES3,
+ ciph_data_des2_key1, 11, ciph_data_in1,
+ ciph_data_des2_ecb_nopad_out1),
+ XTEST_CIPH_CASE(TEE_ALG_DES3_CBC_NOPAD, TEE_TYPE_DES3,
+ ciph_data_des2_key1, ciph_data_64_iv1, 11,
+ ciph_data_in1,
+ ciph_data_des2_cbc_nopad_out1),
+};
+
+static const struct xtest_ciph_case ciph_cases_xts[] = {
+ /* AES-XTS */
+ XTEST_CIPH_CASE_AES_XTS(vect1, 3),
+ XTEST_CIPH_CASE_AES_XTS(vect2, 6),
+ XTEST_CIPH_CASE_AES_XTS(vect3, 7),
+ XTEST_CIPH_CASE_AES_XTS(vect4, 8),
+ XTEST_CIPH_CASE_AES_XTS(vect5, 9),
+ XTEST_CIPH_CASE_AES_XTS(vect6, 13),
+ XTEST_CIPH_CASE_AES_XTS(vect7, 1),
+ XTEST_CIPH_CASE_AES_XTS(vect8, 3),
+ XTEST_CIPH_CASE_AES_XTS(vect9, 2),
+ XTEST_CIPH_CASE_AES_XTS(vect10, 5),
+ XTEST_CIPH_CASE_AES_XTS(vect11, 6),
+ XTEST_CIPH_CASE_AES_XTS(vect12, 7),
+ XTEST_CIPH_CASE_AES_XTS(vect13, 3),
+ XTEST_CIPH_CASE_AES_XTS(vect14, 2),
+ XTEST_CIPH_CASE_AES_XTS(vect15, 0),
+ XTEST_CIPH_CASE_AES_XTS(vect16, 9),
+ XTEST_CIPH_CASE_AES_XTS(vect17, 6),
+ XTEST_CIPH_CASE_AES_XTS(vect18, 8),
+ XTEST_CIPH_CASE_AES_XTS(vect19, 23),
+};
+
+static void xtest_tee_test_4003_no_xts(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ TEE_OperationHandle op;
+ TEE_ObjectHandle key1_handle = TEE_HANDLE_NULL;
+ TEE_ObjectHandle key2_handle = TEE_HANDLE_NULL;
+ uint8_t out[2048];
+ size_t out_size;
+ size_t out_offs;
+ uint32_t ret_orig;
+ size_t n;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ for (n = 0; n < ARRAY_SIZE(ciph_cases); n++) {
+ TEE_Attribute key_attr;
+ size_t key_size;
+ size_t op_key_size;
+
+
+ Do_ADBG_BeginSubCase(c, "Cipher case %d algo 0x%x line %d",
+ (int)n, (unsigned int)ciph_cases[n].algo,
+ (int)ciph_cases[n].line);
+
+ key_attr.attributeID = TEE_ATTR_SECRET_VALUE;
+ key_attr.content.ref.buffer = (void *)ciph_cases[n].key1;
+ key_attr.content.ref.length = ciph_cases[n].key1_len;
+
+ key_size = key_attr.content.ref.length * 8;
+ if (ciph_cases[n].key_type == TEE_TYPE_DES ||
+ ciph_cases[n].key_type == TEE_TYPE_DES3)
+ /* Exclude parity in bit size of key */
+ key_size -= key_size / 8;
+
+ op_key_size = key_size;
+ if (ciph_cases[n].key2 != NULL)
+ op_key_size *= 2;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session, &op,
+ ciph_cases[n].algo, ciph_cases[n].mode,
+ op_key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, &session,
+ ciph_cases[n].key_type, key_size,
+ &key1_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, &session,
+ key1_handle, &key_attr, 1)))
+ goto out;
+
+ if (ciph_cases[n].key2 != NULL) {
+ key_attr.content.ref.buffer =
+ (void *)ciph_cases[n].key2;
+ key_attr.content.ref.length = ciph_cases[n].key2_len;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c,
+ &session, ciph_cases[n].key_type,
+ key_attr.content.ref.length * 8,
+ &key2_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c,
+ &session, key2_handle, &key_attr, 1)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key2(c, &session, op,
+ key1_handle, key2_handle)))
+ goto out;
+ } else {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op,
+ key1_handle)))
+ goto out;
+ }
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ key1_handle)))
+ goto out;
+ key1_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ key2_handle)))
+ goto out;
+ key2_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_cipher_init(c, &session, op,
+ ciph_cases[n].iv, ciph_cases[n].iv_len)))
+ goto out;
+
+ out_offs = 0;
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_cipher_update(c, &session, op,
+ ciph_cases[n].in, ciph_cases[n].in_incr, out,
+ &out_size)))
+ goto out;
+
+ out_offs += out_size;
+ out_size = sizeof(out) - out_offs;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_cipher_do_final(c, &session, op,
+ ciph_cases[n].in + ciph_cases[n].in_incr,
+ ciph_cases[n].in_len - ciph_cases[n].in_incr,
+ out + out_offs,
+ &out_size)))
+ goto out;
+
+ out_offs += out_size;
+
+ (void)ADBG_EXPECT_BUFFER(c, ciph_cases[n].out,
+ ciph_cases[n].out_len, out, out_offs);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op)))
+ goto out;
+
+ Do_ADBG_EndSubCase(c, NULL);
+ }
+out:
+ TEEC_CloseSession(&session);
+}
+
+/*
+ * This is a split of the original xtest 4003 as eary version of the ST TEE.
+ *
+ * Core did not support xts.
+ */
+static void xtest_tee_test_4003_xts(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ TEE_OperationHandle op;
+ TEE_ObjectHandle key1_handle = TEE_HANDLE_NULL;
+ TEE_ObjectHandle key2_handle = TEE_HANDLE_NULL;
+ uint8_t out[2048];
+ size_t out_size;
+ size_t out_offs;
+ uint32_t ret_orig;
+ size_t n;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ for (n = 0; n < ARRAY_SIZE(ciph_cases_xts); n++) {
+ TEE_Attribute key_attr;
+ size_t key_size;
+ size_t op_key_size;
+
+ Do_ADBG_BeginSubCase(c, "Cipher case %d algo 0x%x line %d",
+ (int)n,
+ (unsigned int)ciph_cases_xts[n].algo,
+ (int)ciph_cases_xts[n].line);
+
+ key_attr.attributeID = TEE_ATTR_SECRET_VALUE;
+ key_attr.content.ref.buffer = (void *)ciph_cases_xts[n].key1;
+ key_attr.content.ref.length = ciph_cases_xts[n].key1_len;
+
+ key_size = key_attr.content.ref.length * 8;
+ if (ciph_cases_xts[n].key_type == TEE_TYPE_DES ||
+ ciph_cases_xts[n].key_type == TEE_TYPE_DES3)
+ /* Exclude parity in bit size of key */
+ key_size -= key_size / 8;
+
+ op_key_size = key_size;
+ if (ciph_cases_xts[n].key2 != NULL)
+ op_key_size *= 2;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session, &op,
+ ciph_cases_xts[n].algo, ciph_cases_xts[n].mode,
+ op_key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, &session,
+ ciph_cases_xts[n].key_type, key_size,
+ &key1_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, &session,
+ key1_handle, &key_attr, 1)))
+ goto out;
+
+ if (ciph_cases_xts[n].key2 != NULL) {
+ key_attr.content.ref.buffer =
+ (void *)ciph_cases_xts[n].key2;
+
+ key_attr.content.ref.length =
+ ciph_cases_xts[n].key2_len;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c,
+ &session, ciph_cases_xts[n].key_type,
+ key_attr.content.ref.length * 8,
+ &key2_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c,
+ &session, key2_handle, &key_attr, 1)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key2(c, &session, op,
+ key1_handle, key2_handle)))
+ goto out;
+ } else {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op,
+ key1_handle)))
+ goto out;
+ }
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ key1_handle)))
+ goto out;
+
+ key1_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ key2_handle)))
+ goto out;
+
+ key2_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, ta_crypt_cmd_cipher_init(c,
+ &
+ session,
+ op,
+ ciph_cases_xts
+ [n].iv, ciph_cases_xts[n].iv_len)))
+ goto out;
+
+ out_offs = 0;
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_cipher_update(c, &session, op,
+ ciph_cases_xts[n].in, ciph_cases_xts[n].in_incr,
+ out, &out_size)))
+ goto out;
+
+ out_offs += out_size;
+ out_size = sizeof(out) - out_offs;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_cipher_do_final(c, &session, op,
+ ciph_cases_xts[n].in +
+ ciph_cases_xts[n].in_incr,
+ ciph_cases_xts[n].in_len -
+ ciph_cases_xts[n].in_incr,
+ out + out_offs,
+ &out_size)))
+ goto out;
+ out_offs += out_size;
+
+ (void)ADBG_EXPECT_BUFFER(c, ciph_cases_xts[n].out,
+ ciph_cases_xts[n].out_len, out,
+ out_offs);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op)))
+ goto out;
+
+ Do_ADBG_EndSubCase(c, NULL);
+ }
+out:
+ TEEC_CloseSession(&session);
+}
+
+static void xtest_tee_test_4004(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+ uint8_t buf1[45] = { 0 };
+ uint8_t buf2[45] = { 0 };
+ static const uint8_t zeros[45] = { 0 };
+
+ Do_ADBG_BeginSubCase(c, "TEE get random");
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_random_number_generate(c, &session, buf1,
+ sizeof(buf1))))
+ goto out;
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, !=, memcmp(buf1, zeros, sizeof(buf1)));
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_random_number_generate(c, &session, buf2,
+ sizeof(buf2))))
+ goto out;
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, !=, memcmp(buf2, zeros, sizeof(buf2)));
+
+ (void)ADBG_EXPECT_COMPARE_SIGNED(c,
+ 0, !=, memcmp(buf2, buf1, sizeof(buf1)));
+out:
+ TEEC_CloseSession(&session);
+ Do_ADBG_EndSubCase(c, "TEE get random");
+}
+
+
+struct xtest_ae_case {
+ uint32_t algo;
+ uint32_t mode;
+ uint32_t key_type;
+ const uint8_t *key;
+ size_t key_len;
+ const uint8_t *nonce;
+ size_t nonce_len;
+ size_t aad_incr;
+ const uint8_t *aad;
+ size_t aad_len;
+ size_t in_incr;
+ const uint8_t *ptx;
+ size_t ptx_len;
+ const uint8_t *ctx;
+ size_t ctx_len;
+ const uint8_t *tag;
+ size_t tag_len;
+ size_t line;
+};
+
+
+#define ARRAY(a) a, ARRAY_SIZE(a)
+#define NULL_ARRAY(a) NULL, 0
+
+#define XTEST_AE_CASE(algo, vect, aad_incr, in_incr, \
+ aad_array, ptx_array, ctx_array) \
+ { (algo), TEE_MODE_ENCRYPT, TEE_TYPE_AES, ARRAY(vect ## _key), \
+ ARRAY(vect ## _nonce), (aad_incr), \
+ aad_array(vect ## _aad), (in_incr), \
+ ptx_array(vect ## _ptx), ctx_array(vect ## _ctx), \
+ ARRAY(vect ## _tag), \
+ __LINE__ }, \
+ { (algo), TEE_MODE_DECRYPT, TEE_TYPE_AES, ARRAY(vect ## _key), \
+ ARRAY(vect ## _nonce), (aad_incr), \
+ aad_array(vect ## _aad), (in_incr), \
+ ptx_array(vect ## _ptx), ctx_array(vect ## _ctx), \
+ ARRAY(vect ## _tag), \
+ __LINE__ }
+
+#define XTEST_AE_CASE_AES_CCM(vect, aad_incr, in_incr) \
+ XTEST_AE_CASE(TEE_ALG_AES_CCM, ae_data_aes_ccm_ ## vect, aad_incr, \
+ in_incr, ARRAY, ARRAY, ARRAY)
+
+#define XTEST_AE_CASE_AES_GCM(vect, aad_incr, in_incr, \
+ aad_array, ptx_array, ctx_array) \
+ XTEST_AE_CASE(TEE_ALG_AES_GCM, ae_data_aes_gcm_ ## vect, aad_incr, \
+ in_incr, aad_array, ptx_array, ctx_array)
+
+
+
+static const struct xtest_ae_case ae_cases[] = {
+ XTEST_AE_CASE_AES_CCM(vect1, 3, 2),
+ XTEST_AE_CASE_AES_CCM(vect2, 7, 13),
+ XTEST_AE_CASE_AES_CCM(vect3, 5, 21),
+
+ XTEST_AE_CASE_AES_GCM(vect1, 0, 0, NULL_ARRAY, NULL_ARRAY, NULL_ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect2, 0, 9, NULL_ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect3, 0, 9, NULL_ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect3, 0, 0x20, NULL_ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect4, 5, 9, ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect5, 5, 9, ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect6, 5, 9, ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect7, 0, 0, NULL_ARRAY, NULL_ARRAY, NULL_ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect8, 0, 9, NULL_ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect9, 0, 9, NULL_ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect10, 5, 9, ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect11, 5, 9, ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect12, 5, 9, ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect13, 0, 0, NULL_ARRAY, NULL_ARRAY, NULL_ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect14, 0, 9, NULL_ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect15, 0, 9, NULL_ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect16, 5, 9, ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect17, 5, 9, ARRAY, ARRAY, ARRAY),
+ XTEST_AE_CASE_AES_GCM(vect18, 5, 9, ARRAY, ARRAY, ARRAY),
+};
+
+static void xtest_tee_test_4005(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ TEE_OperationHandle op;
+ TEE_ObjectHandle key_handle = TEE_HANDLE_NULL;
+ TEE_Attribute key_attr;
+ uint8_t out[512];
+ size_t out_size;
+ size_t out_offs;
+ uint32_t ret_orig;
+ size_t n;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ for (n = 0; n < ARRAY_SIZE(ae_cases); n++) {
+ Do_ADBG_BeginSubCase(c, "AE case %d algo 0x%x line %d",
+ (int)n, (unsigned int)ae_cases[n].algo,
+ (int)ae_cases[n].line);
+
+ key_attr.attributeID = TEE_ATTR_SECRET_VALUE;
+ key_attr.content.ref.buffer = (void *)ae_cases[n].key;
+ key_attr.content.ref.length = ae_cases[n].key_len;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session, &op,
+ ae_cases[n].algo, ae_cases[n].mode,
+ key_attr.content.ref.length * 8)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, &session,
+ ae_cases[n].key_type,
+ key_attr.content.ref.length * 8,
+ &key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, &session,
+ key_handle, &key_attr, 1)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op,
+ key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ key_handle)))
+ goto out;
+ key_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_ae_init(c, &session, op, ae_cases[n].nonce,
+ ae_cases[n].nonce_len, ae_cases[n].tag_len,
+ ae_cases[n].aad_len, ae_cases[n].ptx_len)))
+ goto out;
+
+ if (ae_cases[n].aad != NULL) {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_ae_update_aad(c, &session, op,
+ ae_cases[n].aad, ae_cases[n].aad_incr)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_ae_update_aad(c, &session, op,
+ ae_cases[n].aad + ae_cases[n].aad_incr,
+ ae_cases [n].aad_len -
+ ae_cases[n].aad_incr)))
+ goto out;
+ }
+
+ out_offs = 0;
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (ae_cases[n].mode == TEE_MODE_ENCRYPT) {
+ if (ae_cases[n].ptx != NULL) {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_ae_update(c, &session, op,
+ ae_cases[n].ptx,
+ ae_cases[n].in_incr, out,
+ &out_size)))
+ goto out;
+ out_offs += out_size;
+ }
+ } else {
+ if (ae_cases[n].ctx != NULL) {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_ae_update(c, &session, op,
+ ae_cases[n].ctx,
+ ae_cases[n].in_incr, out,
+ &out_size)))
+ goto out;
+ out_offs += out_size;
+ }
+ }
+
+ out_size = sizeof(out) - out_offs;
+ if (ae_cases[n].mode == TEE_MODE_ENCRYPT) {
+ uint8_t out_tag[64];
+ size_t out_tag_len = MIN(sizeof(out_tag),
+ ae_cases[n].tag_len);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_ae_encrypt_final(c, &session, op,
+ ae_cases[n].ptx + ae_cases[n].in_incr,
+ ae_cases[n].ptx_len -
+ ae_cases[n].in_incr,
+ out + out_offs,
+ &out_size, out_tag, &out_tag_len)))
+ goto out;
+
+ (void)ADBG_EXPECT_BUFFER(c,
+ ae_cases[n].tag, ae_cases[n].tag_len, out_tag,
+ out_tag_len);
+
+ out_offs += out_size;
+
+ (void)ADBG_EXPECT_BUFFER(c, ae_cases[n].ctx,
+ ae_cases[n].ctx_len, out, out_offs);
+ } else {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_ae_decrypt_final(c, &session, op,
+ ae_cases[n].ctx + ae_cases[n].in_incr,
+ ae_cases[n].ctx_len -
+ ae_cases[n].in_incr,
+ out + out_offs,
+ &out_size, ae_cases[n].tag,
+ ae_cases[n].tag_len)))
+ goto out;
+
+ out_offs += out_size;
+
+ (void)ADBG_EXPECT_BUFFER(c, ae_cases[n].ptx,
+ ae_cases[n].ptx_len, out, out_offs);
+ }
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op)))
+ goto out;
+
+ Do_ADBG_EndSubCase(c, NULL);
+ }
+out:
+ TEEC_CloseSession(&session);
+}
+
+struct xtest_ac_case {
+ uint32_t algo;
+ TEE_OperationMode mode;
+
+ union {
+ struct {
+ const uint8_t *modulus;
+ size_t modulus_len;
+
+ const uint8_t *pub_exp;
+ size_t pub_exp_len;
+
+ const uint8_t *priv_exp;
+ size_t priv_exp_len;
+
+ const uint8_t *prime1; /* q */
+ size_t prime1_len;
+ const uint8_t *prime2; /* p */
+ size_t prime2_len;
+ const uint8_t *exp1; /* dp */
+ size_t exp1_len;
+ const uint8_t *exp2; /* dq */
+ size_t exp2_len;
+ const uint8_t *coeff; /* iq */
+ size_t coeff_len;
+
+ int salt_len;
+ } rsa;
+ struct {
+ const uint8_t *prime;
+ size_t prime_len;
+ const uint8_t *sub_prime;
+ size_t sub_prime_len;
+ const uint8_t *base;
+ size_t base_len;
+ const uint8_t *pub_val;
+ size_t pub_val_len;
+ const uint8_t *priv_val;
+ size_t priv_val_len;
+ } dsa;
+ } params;
+
+ const uint8_t *ptx;
+ size_t ptx_len;
+ const uint8_t *ctx;
+ size_t ctx_len;
+ size_t line;
+};
+
+#define WITHOUT_SALT(x) -1
+#define WITH_SALT(x) x
+
+#define XTEST_AC_CASE(algo, mode, vect, union_params) \
+ { (algo), (mode), .params = union_params, \
+ ARRAY(vect ## _ptx), \
+ ARRAY(vect ## _out), \
+ __LINE__ }
+
+#define XTEST_AC_RSA_UNION(vect, opt_crt_array, opt_salt) \
+ { .rsa = { \
+ ARRAY(vect ## _modulus), \
+ ARRAY(vect ## _pub_exp), \
+ ARRAY(vect ## _priv_exp), \
+ opt_crt_array(vect ## _prime1), \
+ opt_crt_array(vect ## _prime2), \
+ opt_crt_array(vect ## _exp1), \
+ opt_crt_array(vect ## _exp2), \
+ opt_crt_array(vect ## _coeff), \
+ opt_salt(vect ## _salt_len) \
+ } }
+
+#define XTEST_AC_RSA_CASE(algo, mode, vect, opt_crt_array, opt_salt) \
+ XTEST_AC_CASE(algo, mode, vect, \
+ XTEST_AC_RSA_UNION(vect, opt_crt_array, opt_salt))
+
+#define XTEST_AC_DSA_UNION(vect) \
+ { .dsa = { \
+ ARRAY(vect ## _prime), \
+ ARRAY(vect ## _sub_prime), \
+ ARRAY(vect ## _base), \
+ ARRAY(vect ## _pub_val), \
+ ARRAY(vect ## _priv_val), \
+ } }
+
+#define XTEST_AC_DSA_CASE(algo, mode, vect) \
+ XTEST_AC_CASE(algo, mode, vect, XTEST_AC_DSA_UNION(vect))
+
+static const struct xtest_ac_case xtest_ac_cases[] = {
+ /* RSA test without crt parameters */
+ XTEST_AC_RSA_CASE(TEE_ALG_RSA_NOPAD, TEE_MODE_ENCRYPT,
+ ac_rsassa_vect1, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSA_NOPAD, TEE_MODE_DECRYPT,
+ ac_rsassa_vect1, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSA_NOPAD, TEE_MODE_ENCRYPT,
+ ac_rsassa_vect2, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSA_NOPAD, TEE_MODE_DECRYPT,
+ ac_rsassa_vect2, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect3, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect3, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect4, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect4, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect5, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect5, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect6, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect6, NULL_ARRAY, WITHOUT_SALT),
+
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect7, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect7, NULL_ARRAY, WITHOUT_SALT),
+
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect8, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect8, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA224, TEE_MODE_SIGN,
+ ac_rsassa_vect16, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA224, TEE_MODE_VERIFY,
+ ac_rsassa_vect16, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA256, TEE_MODE_SIGN,
+ ac_rsassa_vect9, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA256, TEE_MODE_VERIFY,
+ ac_rsassa_vect9, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA384, TEE_MODE_SIGN,
+ ac_rsassa_vect10, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA384, TEE_MODE_VERIFY,
+ ac_rsassa_vect10, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA512, TEE_MODE_SIGN,
+ ac_rsassa_vect11, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA512, TEE_MODE_VERIFY,
+ ac_rsassa_vect11, NULL_ARRAY, WITHOUT_SALT),
+
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect12, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect12, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224, TEE_MODE_VERIFY,
+ ac_rsassa_vect17, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224, TEE_MODE_SIGN,
+ ac_rsassa_vect17, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256, TEE_MODE_VERIFY,
+ ac_rsassa_vect13, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256, TEE_MODE_SIGN,
+ ac_rsassa_vect13, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384, TEE_MODE_VERIFY,
+ ac_rsassa_vect14, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384, TEE_MODE_SIGN,
+ ac_rsassa_vect14, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512, TEE_MODE_VERIFY,
+ ac_rsassa_vect15, NULL_ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512, TEE_MODE_SIGN,
+ ac_rsassa_vect15, NULL_ARRAY, WITH_SALT),
+
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_DECRYPT,
+ ac_rsaes_pkcs1_v1_5_vect1, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_ENCRYPT,
+ ac_rsaes_pkcs1_v1_5_vect1, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_DECRYPT,
+ ac_rsaes_pkcs1_v1_5_vect2, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_ENCRYPT,
+ ac_rsaes_pkcs1_v1_5_vect2, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_DECRYPT,
+ ac_rsaes_pkcs1_v1_5_vect15, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_ENCRYPT,
+ ac_rsaes_pkcs1_v1_5_vect15, NULL_ARRAY, WITHOUT_SALT),
+
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_DECRYPT,
+ ac_rsaes_oaep_vect1, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_ENCRYPT,
+ ac_rsaes_oaep_vect1, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_DECRYPT,
+ ac_rsaes_oaep_vect2, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_ENCRYPT,
+ ac_rsaes_oaep_vect2, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_DECRYPT,
+ ac_rsaes_oaep_vect10, NULL_ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_ENCRYPT,
+ ac_rsaes_oaep_vect10, NULL_ARRAY, WITHOUT_SALT),
+
+ /* RSA test with crt parameters */
+ XTEST_AC_RSA_CASE(TEE_ALG_RSA_NOPAD, TEE_MODE_ENCRYPT,
+ ac_rsassa_vect1, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSA_NOPAD, TEE_MODE_DECRYPT,
+ ac_rsassa_vect1, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSA_NOPAD, TEE_MODE_ENCRYPT,
+ ac_rsassa_vect2, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSA_NOPAD, TEE_MODE_DECRYPT,
+ ac_rsassa_vect2, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect3, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect3, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect4, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect4, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect5, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect5, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect6, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect6, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect7, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect7, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect8, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect8, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA256, TEE_MODE_SIGN,
+ ac_rsassa_vect9, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA256, TEE_MODE_VERIFY,
+ ac_rsassa_vect9, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA384, TEE_MODE_SIGN,
+ ac_rsassa_vect10, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA384, TEE_MODE_VERIFY,
+ ac_rsassa_vect10, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA512, TEE_MODE_SIGN,
+ ac_rsassa_vect11, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_V1_5_SHA512, TEE_MODE_VERIFY,
+ ac_rsassa_vect11, ARRAY, WITHOUT_SALT),
+
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1, TEE_MODE_VERIFY,
+ ac_rsassa_vect12, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1, TEE_MODE_SIGN,
+ ac_rsassa_vect12, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224, TEE_MODE_VERIFY,
+ ac_rsassa_vect17, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224, TEE_MODE_SIGN,
+ ac_rsassa_vect17, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256, TEE_MODE_VERIFY,
+ ac_rsassa_vect13, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256, TEE_MODE_SIGN,
+ ac_rsassa_vect13, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384, TEE_MODE_VERIFY,
+ ac_rsassa_vect14, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384, TEE_MODE_SIGN,
+ ac_rsassa_vect14, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512, TEE_MODE_VERIFY,
+ ac_rsassa_vect15, ARRAY, WITH_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512, TEE_MODE_SIGN,
+ ac_rsassa_vect15, ARRAY, WITH_SALT),
+
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_DECRYPT,
+ ac_rsaes_pkcs1_v1_5_vect1, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_ENCRYPT,
+ ac_rsaes_pkcs1_v1_5_vect1, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_DECRYPT,
+ ac_rsaes_pkcs1_v1_5_vect2, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_ENCRYPT,
+ ac_rsaes_pkcs1_v1_5_vect2, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_DECRYPT,
+ ac_rsaes_pkcs1_v1_5_vect15, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_V1_5, TEE_MODE_ENCRYPT,
+ ac_rsaes_pkcs1_v1_5_vect15, ARRAY, WITHOUT_SALT),
+
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_DECRYPT,
+ ac_rsaes_oaep_vect1, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_ENCRYPT,
+ ac_rsaes_oaep_vect1, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_DECRYPT,
+ ac_rsaes_oaep_vect2, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_ENCRYPT,
+ ac_rsaes_oaep_vect2, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_DECRYPT,
+ ac_rsaes_oaep_vect10, ARRAY, WITHOUT_SALT),
+ XTEST_AC_RSA_CASE(TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1, TEE_MODE_ENCRYPT,
+ ac_rsaes_oaep_vect10, ARRAY, WITHOUT_SALT),
+
+ /* DSA tests */
+ XTEST_AC_DSA_CASE(TEE_ALG_DSA_SHA1, TEE_MODE_VERIFY, ac_dsa_vect1),
+ XTEST_AC_DSA_CASE(TEE_ALG_DSA_SHA1, TEE_MODE_SIGN, ac_dsa_vect1),
+ XTEST_AC_DSA_CASE(TEE_ALG_DSA_SHA1, TEE_MODE_VERIFY, ac_dsa_vect2),
+ XTEST_AC_DSA_CASE(TEE_ALG_DSA_SHA1, TEE_MODE_SIGN, ac_dsa_vect2),
+};
+
+static bool create_key(ADBG_Case_t *c, TEEC_Session *s,
+ uint32_t max_key_size, uint32_t key_type,
+ TEE_Attribute *attrs, size_t num_attrs,
+ TEE_ObjectHandle *handle)
+{
+ size_t n;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, s, key_type,
+ max_key_size, handle)))
+ return false;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, s, *handle, attrs,
+ num_attrs)))
+ return false;
+
+ for (n = 0; n < num_attrs; n++) {
+ uint8_t out[256];
+ size_t out_size;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_get_object_buffer_attribute(c, s, *handle,
+ attrs[n].attributeID, out, &out_size)))
+ return false;
+
+ if (!ADBG_EXPECT_BUFFER(c, attrs[n].content.ref.buffer,
+ attrs[n].content.ref.length, out, out_size))
+ return false;
+ }
+
+ return true;
+}
+
+static void xtest_tee_test_4006(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ TEE_OperationHandle op = TEE_HANDLE_NULL;
+ TEE_ObjectHandle priv_key_handle = TEE_HANDLE_NULL;
+ TEE_ObjectHandle pub_key_handle = TEE_HANDLE_NULL;
+ TEE_Attribute key_attrs[8];
+ TEE_Attribute algo_params[1];
+ size_t num_algo_params;
+ uint8_t out[512];
+ size_t out_size;
+ uint8_t out_enc[512];
+ size_t out_enc_size;
+ uint8_t ptx_hash[TEE_MAX_HASH_SIZE];
+ size_t ptx_hash_size;
+ size_t max_key_size;
+ size_t num_key_attrs;
+ uint32_t ret_orig;
+ size_t n;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ for (n = 0; n < ARRAY_SIZE(xtest_ac_cases); n++) {
+ const struct xtest_ac_case *tv = xtest_ac_cases + n;
+
+ Do_ADBG_BeginSubCase(c, "Asym Crypto case %d algo 0x%x line %d",
+ (int)n, (unsigned int)tv->algo,
+ (int)tv->line);
+
+ /*
+ * When signing or verifying we're working with the hash of
+ * the payload.
+ */
+ if (tv->mode == TEE_MODE_VERIFY || tv->mode == TEE_MODE_SIGN) {
+ uint32_t hash_algo = TEE_ALG_HASH_ALGO(
+ TEE_ALG_GET_DIGEST_HASH(
+ tv->algo));
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session,
+ &op, hash_algo, TEE_MODE_DIGEST, 0)))
+ goto out;
+
+ ptx_hash_size = sizeof(ptx_hash);
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_digest_do_final(c, & session, op,
+ tv->ptx, tv->ptx_len, ptx_hash,
+ &ptx_hash_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op)))
+ goto out;
+ }
+
+ num_algo_params = 0;
+ num_key_attrs = 0;
+ switch (TEE_ALG_GET_MAIN_ALG(tv->algo)) {
+ case TEE_MAIN_ALGO_RSA:
+ if (tv->params.rsa.salt_len > 0) {
+ algo_params[0].attributeID =
+ TEE_ATTR_RSA_PSS_SALT_LENGTH;
+ algo_params[0].content.value.a =
+ tv->params.rsa.salt_len;
+ algo_params[0].content.value.b = 0;
+ num_algo_params = 1;
+ }
+
+ max_key_size = tv->params.rsa.modulus_len * 8;
+
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_RSA_MODULUS,
+ tv->params.rsa.modulus,
+ tv->params.rsa.modulus_len);
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_RSA_PUBLIC_EXPONENT,
+ tv->params.rsa.pub_exp,
+ tv->params.rsa.pub_exp_len);
+
+ if (!ADBG_EXPECT_TRUE(c,
+ create_key(c, &session,
+ max_key_size,
+ TEE_TYPE_RSA_PUBLIC_KEY,
+ key_attrs,
+ num_key_attrs,
+ &pub_key_handle)))
+ goto out;
+
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_RSA_PRIVATE_EXPONENT,
+ tv->params.rsa.priv_exp,
+ tv->params.rsa.priv_exp_len);
+
+ if (tv->params.rsa.prime1_len != 0) {
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_RSA_PRIME1,
+ tv->params.rsa.prime1,
+ tv->params.rsa.prime1_len);
+ }
+
+ if (tv->params.rsa.prime2_len != 0) {
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_RSA_PRIME2,
+ tv->params.rsa.prime2,
+ tv->params.rsa.prime2_len);
+ }
+
+ if (tv->params.rsa.exp1_len != 0) {
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_RSA_EXPONENT1,
+ tv->params.rsa.exp1,
+ tv->params.rsa.exp1_len);
+ }
+
+ if (tv->params.rsa.exp2_len != 0) {
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_RSA_EXPONENT2,
+ tv->params.rsa.exp2,
+ tv->params.rsa.exp2_len);
+ }
+
+ if (tv->params.rsa.coeff_len != 0) {
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_RSA_COEFFICIENT,
+ tv->params.rsa.coeff,
+ tv->params.rsa.coeff_len);
+ }
+
+ if (!ADBG_EXPECT_TRUE(c,
+ create_key(c, &session,
+ max_key_size,
+ TEE_TYPE_RSA_KEYPAIR,
+ key_attrs,
+ num_key_attrs,
+ &priv_key_handle)))
+ goto out;
+ break;
+
+ case TEE_MAIN_ALGO_DSA:
+ max_key_size = tv->params.dsa.prime_len * 8;
+
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_DSA_PRIME,
+ tv->params.dsa.prime,
+ tv->params.dsa.prime_len);
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_DSA_SUBPRIME,
+ tv->params.dsa.sub_prime,
+ tv->params.dsa.sub_prime_len);
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_DSA_BASE,
+ tv->params.dsa.base,
+ tv->params.dsa.base_len);
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_DSA_PUBLIC_VALUE,
+ tv->params.dsa.pub_val,
+ tv->params.dsa.pub_val_len);
+
+ if (!ADBG_EXPECT_TRUE(c,
+ create_key(c, &session, max_key_size,
+ TEE_TYPE_DSA_PUBLIC_KEY, key_attrs,
+ num_key_attrs, &pub_key_handle)))
+ goto out;
+
+ xtest_add_attr(&num_key_attrs, key_attrs,
+ TEE_ATTR_DSA_PRIVATE_VALUE,
+ tv->params.dsa.priv_val,
+ tv->params.dsa.priv_val_len);
+
+ if (!ADBG_EXPECT_TRUE(c,
+ create_key(c, &session, max_key_size,
+ TEE_TYPE_DSA_KEYPAIR, key_attrs,
+ num_key_attrs, &priv_key_handle)))
+ goto out;
+ break;
+
+ default:
+ ADBG_EXPECT_TRUE(c, false);
+ goto out;
+ }
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ switch (tv->mode) {
+ case TEE_MODE_ENCRYPT:
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session,
+ &op, tv->algo, TEE_MODE_ENCRYPT, max_key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op,
+ pub_key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ pub_key_handle)))
+ goto out;
+ pub_key_handle = TEE_HANDLE_NULL;
+
+ out_enc_size = sizeof(out_enc);
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_asymmetric_encrypt(c, &session, op,
+ NULL, 0, tv->ptx, tv->ptx_len, out_enc,
+ &out_enc_size)))
+ goto out;
+
+ /*
+ * A PS which is random is added when formatting the
+ * message internally of the algorithm so we can't
+ * verify against precomputed values, instead we use the
+ * decrypt operation to see that output is correct.
+ */
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session,
+ &op, tv->algo, TEE_MODE_DECRYPT,
+ max_key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op,
+ priv_key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ priv_key_handle)))
+ goto out;
+
+ priv_key_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_asymmetric_decrypt(c, &session, op,
+ NULL, 0, out_enc, out_enc_size, out,
+ &out_size)))
+ goto out;
+
+ (void)ADBG_EXPECT_BUFFER(c, tv->ptx, tv->ptx_len, out,
+ out_size);
+ break;
+
+ case TEE_MODE_DECRYPT:
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session,
+ &op, tv->algo, TEE_MODE_DECRYPT,
+ max_key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op,
+ priv_key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ priv_key_handle)))
+ goto out;
+
+ priv_key_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_asymmetric_decrypt(c, &session, op,
+ NULL, 0, tv->ctx, tv->ctx_len, out,
+ &out_size)))
+ goto out;
+
+ (void)ADBG_EXPECT_BUFFER(c, tv->ptx, tv->ptx_len, out,
+ out_size);
+ break;
+
+ case TEE_MODE_VERIFY:
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session,
+ &op, tv->algo, TEE_MODE_VERIFY,
+ max_key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op,
+ pub_key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ pub_key_handle)))
+ goto out;
+
+ pub_key_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_asymmetric_verify(c, &session, op,
+ algo_params, num_algo_params, ptx_hash,
+ ptx_hash_size, tv->ctx, tv->ctx_len)))
+ goto out;
+ break;
+
+ case TEE_MODE_SIGN:
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session,
+ &op, tv->algo, TEE_MODE_SIGN,
+ max_key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op,
+ priv_key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ priv_key_handle)))
+ goto out;
+
+ priv_key_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_asymmetric_sign(c, &session, op,
+ algo_params, num_algo_params, ptx_hash,
+ ptx_hash_size, out, &out_size)))
+ goto out;
+
+ if (TEE_ALG_GET_CHAIN_MODE(tv->algo) ==
+ TEE_CHAIN_MODE_PKCS1_PSS_MGF1 ||
+ tv->algo == TEE_ALG_DSA_SHA1) {
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session,
+ op)))
+ goto out;
+ /*
+ * The salt or K is random so we can't verify
+ * signing against precomputed values, instead
+ * we use the verify operation to see that
+ * output is correct.
+ */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c,
+ &session, &op, tv->algo,
+ TEE_MODE_VERIFY, max_key_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c,
+ &session, op, pub_key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c,
+ &session, pub_key_handle)))
+ goto out;
+
+ pub_key_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_asymmetric_verify(c,
+ &session, op, algo_params,
+ num_algo_params, ptx_hash,
+ ptx_hash_size, out, out_size)))
+ goto out;
+ } else {
+ (void)ADBG_EXPECT_BUFFER(c, tv->ctx,
+ tv->ctx_len, out,
+ out_size);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ pub_key_handle)))
+ goto out;
+ pub_key_handle = TEE_HANDLE_NULL;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session,
+ priv_key_handle)))
+ goto out;
+
+ priv_key_handle = TEE_HANDLE_NULL;
+
+ Do_ADBG_EndSubCase(c, NULL);
+ }
+out:
+ TEEC_CloseSession(&session);
+}
+
+#define KEY_ATTR(x, y) { #x, (x), y }
+
+struct key_attrs {
+ const char *name;
+ uint32_t attr;
+ bool keysize_check;
+};
+
+static bool test_keygen_attributes(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_ObjectHandle key, uint32_t key_size,
+ struct key_attrs *attrs, size_t num_attrs)
+{
+ uint8_t out[2048];
+ size_t out_size;
+ size_t n;
+ size_t m;
+
+ for (m = 0; m < num_attrs; m++) {
+ if ((attrs[m].attr & TEE_ATTR_BIT_VALUE) == 0) {
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_get_object_buffer_attribute(c, s,
+ key, attrs[m].attr, out, &out_size)))
+ return false;
+
+ if (attrs[m].keysize_check)
+ ADBG_EXPECT_COMPARE_UNSIGNED(c, out_size, ==,
+ key_size / 8);
+
+ if (out_size > 0) {
+ /* Check that buffer isn't all zeroes */
+ for (n = 0; n < out_size; n++)
+ if (out[n] != 0)
+ break;
+ if (!ADBG_EXPECT_COMPARE_UNSIGNED(c, n, <,
+ out_size))
+ return false;
+ }
+ } else {
+ uint32_t a;
+ uint32_t b;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_get_object_value_attribute(c, s, key,
+ attrs[m].attr, &a, &b)))
+ return false;
+ }
+ }
+ return true;
+}
+
+static bool test_secret_value(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_ObjectHandle key, uint32_t key_size)
+{
+ const struct key_attrs attrs[] = {
+ KEY_ATTR(TEE_ATTR_SECRET_VALUE, true),
+ };
+
+ return test_keygen_attributes(c, s, key, key_size,
+ (struct key_attrs *)&attrs,
+ ARRAY_SIZE(attrs));
+}
+
+
+static bool test_rsa_key_pair(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_ObjectHandle key, uint32_t key_size)
+{
+ const struct key_attrs attrs[] = {
+ KEY_ATTR(TEE_ATTR_RSA_MODULUS, true),
+ KEY_ATTR(TEE_ATTR_RSA_PUBLIC_EXPONENT, false),
+ KEY_ATTR(TEE_ATTR_RSA_PRIVATE_EXPONENT, false),
+ KEY_ATTR(TEE_ATTR_RSA_PRIME1, false),
+ KEY_ATTR(TEE_ATTR_RSA_PRIME2, false),
+ KEY_ATTR(TEE_ATTR_RSA_EXPONENT1, false),
+ KEY_ATTR(TEE_ATTR_RSA_EXPONENT2, false),
+ KEY_ATTR(TEE_ATTR_RSA_COEFFICIENT, false),
+ };
+
+ return test_keygen_attributes(c, s, key, key_size,
+ (struct key_attrs *)&attrs,
+ ARRAY_SIZE(attrs));
+}
+
+static bool test_dh_key_pair(ADBG_Case_t *c, TEEC_Session *s,
+ uint32_t check_keysize,
+ TEE_ObjectHandle key, uint32_t key_size)
+{
+ const struct key_attrs attrs[] = {
+ KEY_ATTR(TEE_ATTR_DH_PRIME, false),
+ KEY_ATTR(TEE_ATTR_DH_BASE, false),
+ KEY_ATTR(TEE_ATTR_DH_PUBLIC_VALUE, false),
+ KEY_ATTR(TEE_ATTR_DH_PRIVATE_VALUE, check_keysize),
+ KEY_ATTR(TEE_ATTR_DH_X_BITS, false),
+ };
+
+ return test_keygen_attributes(c, s, key, key_size,
+ (struct key_attrs *)&attrs,
+ ARRAY_SIZE(attrs));
+}
+
+static bool test_dsa_key_pair(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_ObjectHandle key, uint32_t key_size)
+{
+ const struct key_attrs attrs[] = {
+ KEY_ATTR(TEE_ATTR_DSA_PRIME, true),
+ KEY_ATTR(TEE_ATTR_DSA_SUBPRIME, false),
+ KEY_ATTR(TEE_ATTR_DSA_BASE, false),
+ KEY_ATTR(TEE_ATTR_DSA_PUBLIC_VALUE, false),
+ KEY_ATTR(TEE_ATTR_DSA_PRIVATE_VALUE, false),
+ };
+
+ return test_keygen_attributes(c, s, key, key_size,
+ (struct key_attrs *)&attrs,
+ ARRAY_SIZE(attrs));
+}
+
+static bool generate_and_test_key(ADBG_Case_t *c, TEEC_Session *s,
+ uint32_t key_type, uint32_t check_keysize,
+ uint32_t key_size,
+ TEE_Attribute *params, size_t param_count)
+{
+ TEE_ObjectHandle key;
+ bool ret_val = true;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, s, key_type, key_size,
+ &key)))
+ return false;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_generate_key(c, s, key, key_size, params,
+ param_count)))
+ return false;
+
+ switch (key_type) {
+ case TEE_TYPE_DES:
+ case TEE_TYPE_DES3:
+ ret_val = ADBG_EXPECT_TRUE(c,
+ test_secret_value(c, s, key,
+ key_size + key_size / 7));
+ break;
+ case TEE_TYPE_AES:
+ case TEE_TYPE_HMAC_MD5:
+ case TEE_TYPE_HMAC_SHA1:
+ case TEE_TYPE_HMAC_SHA224:
+ case TEE_TYPE_HMAC_SHA256:
+ case TEE_TYPE_HMAC_SHA384:
+ case TEE_TYPE_HMAC_SHA512:
+ case TEE_TYPE_GENERIC_SECRET:
+ ret_val = ADBG_EXPECT_TRUE(c,
+ test_secret_value(c, s, key, key_size));
+ break;
+
+ case TEE_TYPE_RSA_KEYPAIR:
+ ret_val = ADBG_EXPECT_TRUE(c,
+ test_rsa_key_pair(c, s, key, key_size));
+ break;
+
+ case TEE_TYPE_DH_KEYPAIR:
+ ret_val =
+ ADBG_EXPECT_TRUE(c,
+ test_dh_key_pair(c, s, check_keysize, key,
+ key_size));
+ break;
+
+ case TEE_TYPE_DSA_KEYPAIR:
+ ret_val = ADBG_EXPECT_TRUE(c,
+ test_dsa_key_pair(c, s, key, key_size));
+ break;
+
+ default:
+ ret_val = false;
+ break;
+ }
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, s, key)))
+ return false;
+
+ return ret_val;
+}
+
+static void xtest_test_keygen_noparams(ADBG_Case_t *c, TEEC_Session *session)
+{
+ size_t n;
+ uint32_t key_size;
+ static const struct {
+ const char *name;
+ uint32_t key_type;
+ uint32_t quanta;
+ uint32_t min_size;
+ uint32_t max_size;
+ } key_types[] = {
+ { "AES", TEE_TYPE_AES, 64, 128,
+ 256 /* valid sizes 128, 192, 256 */ },
+ { "DES", TEE_TYPE_DES, 56, 56, 56 /* valid size 56 */ },
+ { "DES3", TEE_TYPE_DES3, 56, 112,
+ 168 /* valid sizes 112, 168 */ },
+ { "HMAC-MD5", TEE_TYPE_HMAC_MD5, 8, 64, 512 },
+ { "HMAC-SHA1", TEE_TYPE_HMAC_SHA1, 8, 80, 512 },
+ { "HMAC-SHA224", TEE_TYPE_HMAC_SHA224, 8, 112, 512 },
+ { "HMAC-SHA256", TEE_TYPE_HMAC_SHA256, 8, 192, 1024 },
+ { "HMAC-SHA384", TEE_TYPE_HMAC_SHA384, 8, 256, 1024 },
+ { "HMAC-SHA512", TEE_TYPE_HMAC_SHA512, 8, 256, 1024 },
+ { "Generic secret", TEE_TYPE_GENERIC_SECRET, 8, 128, 4096 },
+ { "RSA-2048", TEE_TYPE_RSA_KEYPAIR, 1, 2048, 2048 },
+
+ /* New tests added to check non-regression of issue #5398 */
+ { "RSA-256", TEE_TYPE_RSA_KEYPAIR, 1, 256, 256 },
+ { "RSA-384", TEE_TYPE_RSA_KEYPAIR, 1, 384, 384 },
+ { "RSA-512", TEE_TYPE_RSA_KEYPAIR, 1, 512, 512 },
+ { "RSA-640", TEE_TYPE_RSA_KEYPAIR, 1, 640, 640 },
+ { "RSA-768", TEE_TYPE_RSA_KEYPAIR, 1, 768, 768 },
+ { "RSA-896", TEE_TYPE_RSA_KEYPAIR, 1, 896, 896 },
+ { "RSA-1024", TEE_TYPE_RSA_KEYPAIR, 1, 1024, 1024 },
+ };
+
+ for (n = 0; n < ARRAY_SIZE(key_types); n++) {
+ uint32_t min_size = key_types[n].min_size;
+ uint32_t max_size = key_types[n].max_size;
+ uint32_t quanta = key_types[n].quanta;
+
+ Do_ADBG_BeginSubCase(c, "Generate %s key", key_types[n].name);
+
+ for (key_size = min_size; key_size <= max_size;
+ key_size += quanta) {
+ if (!ADBG_EXPECT_TRUE(c,
+ generate_and_test_key(c, session, key_types
+ [n].key_type, 1, key_size, NULL, 0)))
+ break;
+ }
+
+ Do_ADBG_EndSubCase(c, "Generate %s key", key_types[n].name);
+ }
+}
+
+static void xtest_test_keygen_dh(ADBG_Case_t *c, TEEC_Session *session)
+{
+ size_t n;
+ size_t param_count;
+ /*
+ * Note that the key size parameter is not used when creating the keys
+ * but specifying these sizes make it possible to test the expected size
+ * of the private value. This also means that the keysize must match the
+ * size of p or what is specified in private_bits or the equvivalent
+ * size of the subprime parameter.
+ */
+ TEE_Attribute params[4];
+
+#define XTEST_DH_GK_DATA(vect) \
+ ARRAY(vect ## _p), \
+ ARRAY(vect ## _g), \
+ &vect ## _private_bits, \
+ 0, 0
+#define XTEST_DH_GK_DATA_SUBPRIME(vect) \
+ ARRAY(vect ## _p), \
+ ARRAY(vect ## _g), \
+ &vect ## _private_bits, \
+ ARRAY(vect ## _subprime)
+ static const struct {
+ uint32_t key_size;
+ const uint8_t *p;
+ size_t p_len;
+ const uint8_t *g;
+ size_t g_len;
+ const uint32_t *private_bits;
+ const uint8_t *subprime;
+ size_t subprime_len;
+ } key_types[] = {
+ { 256, XTEST_DH_GK_DATA(keygen_dh256) },
+ { 256, XTEST_DH_GK_DATA(keygen_dh320) },
+ { 384, XTEST_DH_GK_DATA(keygen_dh384) },
+ { 256, XTEST_DH_GK_DATA(keygen_dh448) },
+ { 512, XTEST_DH_GK_DATA(keygen_dh512) },
+ { 288, XTEST_DH_GK_DATA(keygen_dh576) },
+ { 640, XTEST_DH_GK_DATA(keygen_dh640) },
+ { 352, XTEST_DH_GK_DATA(keygen_dh704) },
+ { 768, XTEST_DH_GK_DATA(keygen_dh768) },
+ { 416, XTEST_DH_GK_DATA(keygen_dh832) },
+ { 896, XTEST_DH_GK_DATA(keygen_dh896) },
+ { 480, XTEST_DH_GK_DATA(keygen_dh960) },
+ { 1024, XTEST_DH_GK_DATA(keygen_dh1024) },
+ { 544, XTEST_DH_GK_DATA(keygen_dh1088) },
+ { 1152, XTEST_DH_GK_DATA(keygen_dh1152) },
+ { 608, XTEST_DH_GK_DATA(keygen_dh1216) },
+ { 1280, XTEST_DH_GK_DATA(keygen_dh1280) },
+ { 672, XTEST_DH_GK_DATA(keygen_dh1344) },
+ { 1408, XTEST_DH_GK_DATA(keygen_dh1408) },
+ { 736, XTEST_DH_GK_DATA(keygen_dh1472) },
+ { 1536, XTEST_DH_GK_DATA(keygen_dh1536) },
+ { 800, XTEST_DH_GK_DATA(keygen_dh1600) },
+ { 1664, XTEST_DH_GK_DATA(keygen_dh1664) },
+ { 864, XTEST_DH_GK_DATA(keygen_dh1728) },
+ { 1792, XTEST_DH_GK_DATA(keygen_dh1792) },
+ { 928, XTEST_DH_GK_DATA(keygen_dh1856) },
+ { 1920, XTEST_DH_GK_DATA(keygen_dh1920) },
+ { 992, XTEST_DH_GK_DATA(keygen_dh1984) },
+ { 2048, XTEST_DH_GK_DATA(keygen_dh2048) },
+ { 256, XTEST_DH_GK_DATA_SUBPRIME(keygen_dh2048_subprime) }
+ };
+
+
+ for (n = 0; n < ARRAY_SIZE(key_types); n++) {
+ Do_ADBG_BeginSubCase(c,
+ "Generate DH key %d bits - Private bits = %d",
+ key_types[n].key_size,
+ *key_types[n].private_bits);
+ param_count = 0;
+
+ xtest_add_attr(¶m_count, params,
+ TEE_ATTR_DH_PRIME,
+ key_types[n].p, key_types[n].p_len);
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DH_BASE,
+ key_types[n].g, key_types[n].g_len);
+
+ if (key_types[n].private_bits != 0) {
+ params[param_count].attributeID = TEE_ATTR_DH_X_BITS;
+
+ params[param_count].content.value.a =
+ *key_types[n].private_bits;
+
+ params[param_count].content.value.b = 0;
+ param_count++;
+ }
+
+ if (key_types[n].subprime != 0) {
+ xtest_add_attr(¶m_count, params,
+ TEE_ATTR_DH_SUBPRIME,
+ key_types[n].subprime,
+ key_types[n].subprime_len);
+ }
+
+ if (!ADBG_EXPECT_TRUE(c,
+ generate_and_test_key(c, session, TEE_TYPE_DH_KEYPAIR,
+ ((*key_types[n].private_bits) != 0),
+ key_types[n]. key_size, params, param_count)))
+ break;
+
+ Do_ADBG_EndSubCase(c,
+ "Generate DH key %d bits - Private bits = %d",
+ key_types[n].key_size,
+ *key_types[n].private_bits);
+ }
+}
+
+static void xtest_test_keygen_dsa(ADBG_Case_t *c, TEEC_Session *session)
+{
+ size_t n;
+ size_t param_count;
+ TEE_Attribute params[4];
+
+#define XTEST_DSA_GK_DATA(vect) \
+ ARRAY(vect ## _p), \
+ ARRAY(vect ## _g), \
+ ARRAY(vect ## _q)
+ static const struct {
+ uint32_t key_size;
+ const uint8_t *prime;
+ size_t prime_len;
+ const uint8_t *base;
+ size_t base_len;
+ const uint8_t *sub_prime;
+ size_t sub_prime_len;
+ } key_types[] = {
+ { 1024, XTEST_DSA_GK_DATA(keygen_dsa_test1) },
+ { 512, XTEST_DSA_GK_DATA(keygen_dsa512) },
+ { 576, XTEST_DSA_GK_DATA(keygen_dsa576) },
+ { 640, XTEST_DSA_GK_DATA(keygen_dsa640) },
+ { 704, XTEST_DSA_GK_DATA(keygen_dsa704) },
+ { 768, XTEST_DSA_GK_DATA(keygen_dsa768) },
+ { 832, XTEST_DSA_GK_DATA(keygen_dsa832) },
+ { 896, XTEST_DSA_GK_DATA(keygen_dsa896) },
+ { 960, XTEST_DSA_GK_DATA(keygen_dsa960) },
+ { 1024, XTEST_DSA_GK_DATA(keygen_dsa1024) },
+ };
+
+ for (n = 0; n < ARRAY_SIZE(key_types); n++) {
+ Do_ADBG_BeginSubCase(c, "Generate DSA key %d bits",
+ key_types[n].key_size);
+ param_count = 0;
+
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DSA_PRIME,
+ key_types[n].prime, key_types[n].prime_len);
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DSA_SUBPRIME,
+ key_types[n].sub_prime,
+ key_types[n].sub_prime_len);
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DSA_BASE,
+ key_types[n].base, key_types[n].base_len);
+
+ if (!ADBG_EXPECT_TRUE(c,
+ generate_and_test_key(c, session, TEE_TYPE_DSA_KEYPAIR,
+ 1, key_types[n]. key_size, params,
+ param_count)))
+ break;
+
+ Do_ADBG_EndSubCase(c, "Generate DSA key %d bits",
+ key_types[n].key_size);
+ }
+}
+
+static void xtest_tee_test_4007(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ xtest_test_keygen_noparams(c, &session);
+
+ xtest_test_keygen_dh(c, &session);
+
+ xtest_test_keygen_dsa(c, &session);
+
+ TEEC_CloseSession(&session);
+}
+
+static void xtest_tee_test_4008(ADBG_Case_t *c)
+{
+ TEEC_Session session = { 0 };
+ uint32_t ret_orig;
+ TEE_OperationHandle op;
+ TEE_ObjectHandle key_handle;
+ TEE_ObjectHandle sv_handle;
+ TEE_Attribute params[4];
+ size_t param_count = 0;
+ uint8_t out[2048];
+ size_t out_size;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&session, &crypt_user_ta_uuid, NULL,
+ &ret_orig)))
+ return;
+
+ Do_ADBG_BeginSubCase(c, "Derive DH key success");
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_operation(c, &session, &op,
+ TEE_ALG_DH_DERIVE_SHARED_SECRET, TEE_MODE_DERIVE,
+ derive_key_max_keysize)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, & session,
+ TEE_TYPE_DH_KEYPAIR, derive_key_max_keysize,
+ &key_handle)))
+ goto out;
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DH_PRIME,
+ ARRAY(derive_key_dh_prime));
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DH_BASE,
+ ARRAY(derive_key_dh_base));
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DH_PUBLIC_VALUE,
+ ARRAY(derive_key_dh_public_value));
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DH_PRIVATE_VALUE,
+ ARRAY(derive_key_dh_private_value));
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_populate_transient_object(c, &session, key_handle,
+ params, param_count)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_set_operation_key(c, &session, op, key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, & session, key_handle)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_allocate_transient_object(c, &session,
+ TEE_TYPE_GENERIC_SECRET, derive_key_max_keysize,
+ &sv_handle)))
+ goto out;
+
+ /* resuse but reset params and param-count */
+ param_count = 0;
+
+ xtest_add_attr(¶m_count, params, TEE_ATTR_DH_PUBLIC_VALUE,
+ ARRAY(derive_key_dh_public_value_2));
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_derive_key(c, &session, op, sv_handle, params,
+ param_count)))
+ goto out;
+
+ out_size = sizeof(out);
+ memset(out, 0, sizeof(out));
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_get_object_buffer_attribute(c, &session, sv_handle,
+ TEE_ATTR_SECRET_VALUE, out, &out_size)))
+ goto out;
+
+ if (!ADBG_EXPECT_BUFFER(c, derive_key_dh_shared_secret,
+ sizeof(derive_key_dh_shared_secret), out,
+ out_size))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_operation(c, &session, op)))
+ goto out;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ ta_crypt_cmd_free_transient_object(c, &session, sv_handle)))
+ goto out;
+out:
+ Do_ADBG_EndSubCase(c, "Derive DH key success");
+ TEEC_CloseSession(&session);
+}
diff --git a/host/xtest/xtest_4000_data.h b/host/xtest/xtest_4000_data.h
new file mode 100644
index 0000000..9c6e2bc
--- /dev/null
+++ b/host/xtest/xtest_4000_data.h
@@ -0,0 +1,6091 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef XTEST_4000_DATA_H
+#define XTEST_4000_DATA_H
+#include <stdint.h>
+
+/*
+ * XTS-AES Test data from:
+ * http://grouper.ieee.org/groups/1619/email/pdf00086.pdf
+ */
+
+/*
+ * XTS-AES applied for a data unit of 32 bytes, 32 bytes key material.
+ */
+
+/* Vector 1 */
+static const uint8_t ciph_data_aes_xts_vect1_key1[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+static const uint8_t ciph_data_aes_xts_vect1_key2[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+static const uint8_t ciph_data_aes_xts_vect1_iv[16] = {
+ 0x0
+};
+static const uint8_t ciph_data_aes_xts_vect1_ptx[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+/* TWK 66e94bd4ef8a2c3b884cfa59ca342b2eccd297a8df1559761099f4b39469565c */
+static const uint8_t ciph_data_aes_xts_vect1_ctx[] = {
+ 0x91, 0x7c, 0xf6, 0x9e, 0xbd, 0x68, 0xb2, 0xec,
+ 0x9b, 0x9f, 0xe9, 0xa3, 0xea, 0xdd, 0xa6, 0x92,
+ 0xcd, 0x43, 0xd2, 0xf5, 0x95, 0x98, 0xed, 0x85,
+ 0x8c, 0x02, 0xc2, 0x65, 0x2f, 0xbf, 0x92, 0x2e,
+};
+
+/* Vector 2 */
+static const uint8_t ciph_data_aes_xts_vect2_key1[] = {
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+};
+static const uint8_t ciph_data_aes_xts_vect2_key2[] = {
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+};
+static const uint8_t ciph_data_aes_xts_vect2_iv[16] = {
+ 0x33, 0x33, 0x33, 0x33, 0x33
+};
+static const uint8_t ciph_data_aes_xts_vect2_ptx[] = {
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+};
+/* TWK 3f803bcd0d7fd2b37558419f59d5cda6f900779a1bfea467ebb0823eb3aa9b4d */
+static const uint8_t ciph_data_aes_xts_vect2_ctx[] = {
+ 0xc4, 0x54, 0x18, 0x5e, 0x6a, 0x16, 0x93, 0x6e,
+ 0x39, 0x33, 0x40, 0x38, 0xac, 0xef, 0x83, 0x8b,
+ 0xfb, 0x18, 0x6f, 0xff, 0x74, 0x80, 0xad, 0xc4,
+ 0x28, 0x93, 0x82, 0xec, 0xd6, 0xd3, 0x94, 0xf0,
+};
+
+/* Vector 3 */
+static const uint8_t ciph_data_aes_xts_vect3_key1[] = {
+ 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
+ 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0,
+};
+static const uint8_t ciph_data_aes_xts_vect3_key2[] = {
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+};
+static const uint8_t ciph_data_aes_xts_vect3_iv[16] = {
+ 0x33, 0x33, 0x33, 0x33, 0x33
+};
+static const uint8_t ciph_data_aes_xts_vect3_ptx[] = {
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+};
+/* TWK 3f803bcd0d7fd2b37558419f59d5cda6f900779a1bfea467ebb0823eb3aa9b4d */
+static const uint8_t ciph_data_aes_xts_vect3_ctx[] = {
+ 0xaf, 0x85, 0x33, 0x6b, 0x59, 0x7a, 0xfc, 0x1a,
+ 0x90, 0x0b, 0x2e, 0xb2, 0x1e, 0xc9, 0x49, 0xd2,
+ 0x92, 0xdf, 0x4c, 0x04, 0x7e, 0x0b, 0x21, 0x53,
+ 0x21, 0x86, 0xa5, 0x97, 0x1a, 0x22, 0x7a, 0x89,
+};
+
+/*
+ * XTS-AES-128 applied for a data unit of 512 bytes
+ */
+
+/* Vector 4 */
+static const uint8_t ciph_data_aes_xts_vect4_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+};
+static const uint8_t ciph_data_aes_xts_vect4_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+};
+static const uint8_t ciph_data_aes_xts_vect4_iv[16] = {
+ 0x00
+};
+static const uint8_t ciph_data_aes_xts_vect4_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x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/* Vector 5 */
+static const uint8_t ciph_data_aes_xts_vect5_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+};
+static const uint8_t ciph_data_aes_xts_vect5_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+};
+static const uint8_t ciph_data_aes_xts_vect5_iv[16] = {
+ 0x01
+};
+static const uint8_t ciph_data_aes_xts_vect5_ptx[] = {
+ 0x27, 0xa7, 0x47, 0x9b, 0xef, 0xa1, 0xd4, 0x76,
+ 0x48, 0x9f, 0x30, 0x8c, 0xd4, 0xcf, 0xa6, 0xe2,
+ 0xa9, 0x6e, 0x4b, 0xbe, 0x32, 0x08, 0xff, 0x25,
+ 0x28, 0x7d, 0xd3, 0x81, 0x96, 0x16, 0xe8, 0x9c,
+
+ 0xc7, 0x8c, 0xf7, 0xf5, 0xe5, 0x43, 0x44, 0x5f,
+ 0x83, 0x33, 0xd8, 0xfa, 0x7f, 0x56, 0x00, 0x00,
+ 0x05, 0x27, 0x9f, 0xa5, 0xd8, 0xb5, 0xe4, 0xad,
+ 0x40, 0xe7, 0x36, 0xdd, 0xb4, 0xd3, 0x54, 0x12,
+
+ 0x32, 0x80, 0x63, 0xfd, 0x2a, 0xab, 0x53, 0xe5,
+ 0xea, 0x1e, 0x0a, 0x9f, 0x33, 0x25, 0x00, 0xa5,
+ 0xdf, 0x94, 0x87, 0xd0, 0x7a, 0x5c, 0x92, 0xcc,
+ 0x51, 0x2c, 0x88, 0x66, 0xc7, 0xe8, 0x60, 0xce,
+
+ 0x93, 0xfd, 0xf1, 0x66, 0xa2, 0x49, 0x12, 0xb4,
+ 0x22, 0x97, 0x61, 0x46, 0xae, 0x20, 0xce, 0x84,
+ 0x6b, 0xb7, 0xdc, 0x9b, 0xa9, 0x4a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 0x3e, 0xab,
+ 0x5d, 0x54, 0xde, 0x5f, 0x97, 0x38, 0xb8, 0xd2,
+ 0x7f, 0x27, 0xa9, 0xf0, 0xab, 0x11, 0x79, 0x9d,
+ 0x7b, 0x7f, 0xfe, 0xfb, 0x27, 0x04, 0xc9, 0x5c,
+
+ 0x6a, 0xd1, 0x2c, 0x39, 0xf1, 0xe8, 0x67, 0xa4,
+ 0xb7, 0xb1, 0xd7, 0x81, 0x8a, 0x4b, 0x75, 0x3d,
+ 0xfd, 0x2a, 0x89, 0xcc, 0xb4, 0x5e, 0x00, 0x1a,
+ 0x03, 0xa8, 0x67, 0xb1, 0x87, 0xf2, 0x25, 0xdd,
+};
+
+/* Vector 6 */
+static const uint8_t ciph_data_aes_xts_vect6_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+};
+static const uint8_t ciph_data_aes_xts_vect6_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+};
+static const uint8_t ciph_data_aes_xts_vect6_iv[16] = {
+ 0x02
+};
+static const uint8_t ciph_data_aes_xts_vect6_ptx[] = {
+ 0x26, 0x4d, 0x3c, 0xa8, 0x51, 0x21, 0x94, 0xfe,
+ 0xc3, 0x12, 0xc8, 0xc9, 0x89, 0x1f, 0x27, 0x9f,
+ 0xef, 0xdd, 0x60, 0x8d, 0x0c, 0x02, 0x7b, 0x60,
+ 0x48, 0x3a, 0x3f, 0xa8, 0x11, 0xd6, 0x5e, 0xe5,
+
+ 0x9d, 0x52, 0xd9, 0xe4, 0x0e, 0xc5, 0x67, 0x2d,
+ 0x81, 0x53, 0x2b, 0x38, 0xb6, 0xb0, 0x89, 0xce,
+ 0x95, 0x1f, 0x0f, 0x9c, 0x35, 0x59, 0x0b, 0x8b,
+ 0x97,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, 0x08, 0x97, 0xbc, 0x7a, 0xab,
+ 0xd8, 0xd7, 0x07, 0xdc, 0x14, 0x0a, 0x80, 0xf0,
+ 0xf3, 0x09, 0xf8, 0x35, 0xd3, 0xda, 0x54, 0xab,
+
+ 0x58, 0x4e, 0x50, 0x1d, 0xfa, 0x0e, 0xe9, 0x77,
+ 0xfe, 0xc5, 0x43, 0xf7, 0x41, 0x86, 0xa8, 0x02,
+ 0xb9, 0xa3, 0x7a, 0xdb, 0x3e, 0x82, 0x91, 0xec,
+ 0xa0, 0x4d, 0x66, 0x52, 0x0d, 0x22, 0x9e, 0x60,
+
+ 0x40, 0x1e, 0x72, 0x82, 0xbe, 0xf4, 0x86, 0xae,
+ 0x05, 0x9a, 0xa7, 0x06, 0x96, 0xe0, 0xe3, 0x05,
+ 0xd7, 0x77, 0x14, 0x0a, 0x7a, 0x88, 0x3e, 0xcd,
+ 0xcb, 0x69, 0xb9, 0xff, 0x93, 0x8e, 0x8a, 0x42,
+
+ 0x31, 0x86, 0x4c, 0x69, 0xca, 0x2c, 0x20, 0x43,
+ 0xbe, 0xd0, 0x07, 0xff, 0x3e, 0x60, 0x5e, 0x01,
+ 0x4b, 0xcf, 0x51, 0x81, 0x38, 0xdc, 0x3a, 0x25,
+ 0xc5, 0xe2, 0x36, 0x17, 0x1a, 0x2d, 0x01, 0xd6,
+};
+
+/* Vector 7 */
+static const uint8_t ciph_data_aes_xts_vect7_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+};
+static const uint8_t ciph_data_aes_xts_vect7_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+};
+static const uint8_t ciph_data_aes_xts_vect7_iv[16] = {
+ 0xfd
+};
+static const uint8_t ciph_data_aes_xts_vect7_ptx[] = {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, 0x26, 0x06, 0x37,
+};
+
+/* Vector 8 */
+static const uint8_t ciph_data_aes_xts_vect8_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+};
+static const uint8_t ciph_data_aes_xts_vect8_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+};
+static const uint8_t ciph_data_aes_xts_vect8_iv[16] = {
+ 0xfe
+};
+static const uint8_t ciph_data_aes_xts_vect8_ptx[] = {
+ 0xd5, 0x5f, 0x68, 0x4f, 0x81, 0xf4, 0x42, 0x6e,
+ 0x9f, 0xde, 0x92, 0xa5, 0xff, 0x02, 0xdf, 0x2a,
+ 0xc8, 0x96, 0xaf, 0x63, 0x96, 0x28, 0x88, 0xa9,
+ 0x79, 0x10, 0xc1, 0x37, 0x9e, 0x20, 0xb0, 0xa3,
+
+ 0xb1, 0xdb, 0x61, 0x3f, 0xb7, 0xfe, 0x2e, 0x07,
+ 0x00, 0x43, 0x29, 0xea, 0x5c, 0x22, 0xbf, 0xd3,
+ 0x3e, 0x3d, 0xbe, 0x4c, 0xf5, 0x8c, 0xc6, 0x08,
+ 0xc2, 0xc2, 0x6c, 0x19, 0xa2, 0xe2, 0xfe, 0x22,
+
+ 0xf9, 0x87, 0x32, 0xc2, 0xb5, 0xcb, 0x84, 0x4c,
+ 0xc6, 0xc0, 0x70, 0x2d, 0x91, 0xe1, 0xd5, 0x0f,
+ 0xc4, 0x38, 0x2a, 0x7e, 0xba, 0x56, 0x35, 0xcd,
+ 0x60, 0x24, 0x32, 0xa2, 0x30, 0x6a, 0xc4, 0xce,
+
+ 0x82, 0xf8, 0xd7, 0x0c, 0x8d, 0x9b, 0xc1, 0x5f,
+ 0x91, 0x8f, 0xe7, 0x1e, 0x74, 0xc6, 0x22, 0xd5,
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, 0x32, 0x20, 0x28, 0xa7, 0x46, 0x48, 0x11,
+ 0x3b, 0xd8, 0xc9, 0xd7, 0xec, 0x77, 0xcf, 0x3c,
+ 0x89, 0xc1, 0xec, 0x87, 0x18, 0xce, 0xff, 0x85,
+ 0x16, 0xd9, 0x6b, 0x34, 0xc3, 0xc6, 0x14, 0xf1,
+
+ 0x06, 0x99, 0xc9, 0xab, 0xc4, 0xed, 0x04, 0x11,
+ 0x50, 0x62, 0x23, 0xbe, 0xa1, 0x6a, 0xf3, 0x5c,
+ 0x88, 0x3a, 0xcc, 0xdb, 0xe1, 0x10, 0x4e, 0xef,
+ 0x0c, 0xfd, 0xb5, 0x4e, 0x12, 0xfb, 0x23, 0x0a,
+};
+
+/* Vector 9 */
+static const uint8_t ciph_data_aes_xts_vect9_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+};
+static const uint8_t ciph_data_aes_xts_vect9_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+};
+static const uint8_t ciph_data_aes_xts_vect9_iv[16] = {
+ 0xff
+};
+static const uint8_t ciph_data_aes_xts_vect9_ptx[] = {
+ 0x72, 0xef, 0xc1, 0xeb, 0xfe, 0x1e, 0xe2, 0x59,
+ 0x75, 0xa6, 0xeb, 0x3a, 0xa8, 0x58, 0x9d, 0xda,
+ 0x2b, 0x26, 0x1f, 0x1c, 0x85, 0xbd, 0xab, 0x44,
+ 0x2a, 0x9e, 0x5b, 0x2d, 0xd1, 0xd7, 0xc3, 0x95,
+
+ 0x7a, 0x16, 0xfc, 0x08, 0xe5, 0x26, 0xd4, 0xb1,
+ 0x22, 0x3f, 0x1b, 0x12, 0x32, 0xa1, 0x1a, 0xf2,
+ 0x74, 0xc3, 0xd7, 0x0d, 0xac, 0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, 0xdd, 0xb0, 0xbe, 0xbc,
+ 0xb1, 0xdc, 0x64, 0x53, 0x25, 0xbf, 0xb3, 0xe6,
+ 0x65, 0xef, 0x72, 0x51, 0x08, 0x2c, 0x88, 0xeb,
+ 0xb1, 0xcf, 0x20, 0x3b, 0xd7, 0x79, 0xfd, 0xd3,
+
+ 0x86, 0x75, 0x71, 0x3c, 0x8d, 0xaa, 0xdd, 0x17,
+ 0xe1, 0xca, 0xbe, 0xe4, 0x32, 0xb0, 0x97, 0x87,
+ 0xb6, 0xdd, 0xf3, 0x30, 0x4e, 0x38, 0xb7, 0x31,
+ 0xb4, 0x5d, 0xf5, 0xdf, 0x51, 0xb7, 0x8f, 0xcf,
+
+ 0xb3, 0xd3, 0x24, 0x66, 0x02, 0x8d, 0x0b, 0xa3,
+ 0x65, 0x55, 0xe7, 0xe1, 0x1a, 0xb0, 0xee, 0x06,
+ 0x66, 0x06, 0x1d, 0x16, 0x45, 0xd9, 0x62, 0x44,
+ 0x4b, 0xc4, 0x7a, 0x38, 0x18, 0x89, 0x30, 0xa8,
+
+ 0x4b, 0x4d, 0x56, 0x13, 0x95, 0xc7, 0x3c, 0x08,
+ 0x70, 0x21, 0x92, 0x7c, 0xa6, 0x38, 0xb7, 0xaf,
+ 0xc8, 0xa8, 0x67, 0x9c, 0xcb, 0x84, 0xc2, 0x65,
+ 0x55, 0x44, 0x0e, 0xc7, 0xf1, 0x04, 0x45, 0xcd,
+};
+
+/*
+ * XTS-AES-256 applied for a data unit of 512 bytes
+ */
+
+/* Vector 10 */
+static const uint8_t ciph_data_aes_xts_vect10_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+ 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69,
+ 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
+};
+static const uint8_t ciph_data_aes_xts_vect10_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+ 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37,
+ 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
+};
+static const uint8_t ciph_data_aes_xts_vect10_iv[16] = {
+ 0xff
+};
+static const uint8_t ciph_data_aes_xts_vect10_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+
+ 0x80, 0x81, 0x82, 0x83, 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xbe, 0x97,
+ 0xf7, 0xab, 0x40, 0x66, 0x19, 0x3c, 0x4c, 0xaa,
+
+ 0x77, 0x3d, 0xad, 0x38, 0x01, 0x4b, 0xd2, 0x09,
+ 0x2f, 0xa7, 0x55, 0xc8, 0x24, 0xbb, 0x5e, 0x54,
+ 0xc4, 0xf3, 0x6f, 0xfd, 0xa9, 0xfc, 0xea, 0x70,
+ 0xb9, 0xc6, 0xe6, 0x93, 0xe1, 0x48, 0xc1, 0x51,
+};
+
+/* Vector 11 */
+static const uint8_t ciph_data_aes_xts_vect11_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+ 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69,
+ 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
+};
+static const uint8_t ciph_data_aes_xts_vect11_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+ 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37,
+ 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
+};
+static const uint8_t ciph_data_aes_xts_vect11_iv[16] = {
+ 0xff, 0xff
+};
+static const uint8_t ciph_data_aes_xts_vect11_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0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63,
+
+ 0x09, 0x4f, 0x7c, 0x45, 0x3b, 0x7f, 0xf8, 0x7c,
+ 0xb5, 0xbb, 0x36, 0xb7, 0xc7, 0x9e, 0xfb, 0x08,
+ 0x72, 0xd1, 0x70, 0x58, 0xb8, 0x3b, 0x15, 0xab,
+ 0x08, 0x66, 0xad, 0x8a, 0x58, 0x65, 0x6c, 0x5a,
+
+ 0x7e, 0x20, 0xdb, 0xdf, 0x30, 0x8b, 0x24, 0x61,
+ 0xd9, 0x7c, 0x0e, 0xc0, 0x02, 0x4a, 0x27, 0x15,
+ 0x05, 0x52, 0x49, 0xcf, 0x3b, 0x47, 0x8d, 0xdd,
+ 0x47, 0x40, 0xde, 0x65, 0x4f, 0x75, 0xca, 0x68,
+
+ 0x6e, 0x0d, 0x73, 0x45, 0xc6, 0x9e, 0xd5, 0x0c,
+ 0xdc, 0x2a, 0x8b, 0x33, 0x2b, 0x1f, 0x88, 0x24,
+ 0x10, 0x8a, 0xc9, 0x37, 0xeb, 0x05, 0x05, 0x85,
+ 0x60, 0x8e, 0xe7, 0x34, 0x09, 0x7f, 0xc0, 0x90,
+
+ 0x54, 0xfb, 0xff, 0x89, 0xee, 0xae, 0xea, 0x79,
+ 0x1f, 0x4a, 0x7a, 0xb1, 0xf9, 0x86, 0x82, 0x94,
+ 0xa4, 0xf9, 0xe2, 0x7b, 0x42, 0xaf, 0x81, 0x00,
+ 0xcb, 0x9d, 0x59, 0xce, 0xf9, 0x64, 0x58, 0x03,
+};
+
+
+/* Vector 12 */
+static const uint8_t ciph_data_aes_xts_vect12_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+ 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69,
+ 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
+};
+static const uint8_t ciph_data_aes_xts_vect12_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+ 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37,
+ 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
+};
+static const uint8_t ciph_data_aes_xts_vect12_iv[16] = {
+ 0xff, 0xff, 0xff
+};
+static const uint8_t ciph_data_aes_xts_vect12_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+
+ 0x80, 0x81, 0x82, 0x83, 0x84,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0x6b, 0x86, 0x79, 0xc0, 0x0d, 0x35, 0xe0, 0x95,
+ 0x76, 0xa8, 0x75, 0x30, 0x5b, 0xed, 0x5f, 0x36,
+
+ 0xed, 0x24, 0x2c, 0x89, 0x00, 0xdd, 0x1f, 0xa9,
+ 0x65, 0xbc, 0x95, 0x0d, 0xfc, 0xe0, 0x9b, 0x13,
+ 0x22, 0x63, 0xa1, 0xee, 0xf5, 0x2d, 0xd6, 0x88,
+ 0x8c, 0x30, 0x9f, 0x5a, 0x7d, 0x71, 0x28, 0x26,
+};
+
+/* Vector 13 */
+static const uint8_t ciph_data_aes_xts_vect13_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+ 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69,
+ 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
+};
+static const uint8_t ciph_data_aes_xts_vect13_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+ 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37,
+ 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
+};
+static const uint8_t ciph_data_aes_xts_vect13_iv[16] = {
+ 0xff, 0xff, 0xff, 0xff
+};
+static const uint8_t ciph_data_aes_xts_vect13_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x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5c,
+ 0xc8, 0x44, 0x72, 0x6e, 0x8a, 0x72, 0xfc, 0x00,
+
+ 0x77, 0xad, 0x22, 0x00, 0x0f, 0x1d, 0x50, 0x78,
+ 0xf6, 0xb8, 0x66, 0x31, 0x8c, 0x66, 0x8f, 0x1a,
+ 0xd0, 0x3d, 0x5a, 0x5f, 0xce, 0xd5, 0x21, 0x9f,
+ 0x2e, 0xab, 0xbd, 0x0a, 0xa5, 0xc0, 0xf4, 0x60,
+
+ 0xd1, 0x83, 0xf0, 0x44, 0x04, 0xa0, 0xd6, 0xf4,
+ 0x69, 0x55, 0x8e, 0x81, 0xfa, 0xb2, 0x4a, 0x16,
+ 0x79, 0x05, 0xab, 0x4c, 0x78, 0x78, 0x50, 0x2a,
+ 0xd3, 0xe3, 0x8f, 0xdb, 0xe6, 0x2a, 0x41, 0x55,
+
+ 0x6c, 0xec, 0x37, 0x32, 0x57, 0x59, 0x53, 0x3c,
+ 0xe8, 0xf2, 0x5f, 0x36, 0x7c, 0x87, 0xbb, 0x55,
+ 0x78, 0xd6, 0x67, 0xae, 0x93, 0xf9, 0xe2, 0xfd,
+ 0x99, 0xbc, 0xbc, 0x5f, 0x2f, 0xbb, 0xa8, 0x8c,
+
+ 0xf6, 0x51, 0x61, 0x39, 0x42, 0x0f, 0xcf, 0xf3,
+ 0xb7, 0x36, 0x1d, 0x86, 0x32, 0x2c, 0x4b, 0xd8,
+ 0x4c, 0x82, 0xf3, 0x35, 0xab, 0xb1, 0x52, 0xc4,
+ 0xa9, 0x34, 0x11, 0x37, 0x3a, 0xaa, 0x82, 0x20,
+};
+
+/* Vector 14 */
+static const uint8_t ciph_data_aes_xts_vect14_key1[] = {
+ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45,
+ 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26,
+ 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69,
+ 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
+};
+static const uint8_t ciph_data_aes_xts_vect14_key2[] = {
+ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93,
+ 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95,
+ 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37,
+ 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
+};
+static const uint8_t ciph_data_aes_xts_vect14_iv[16] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff
+};
+static const uint8_t ciph_data_aes_xts_vect14_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7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0xf8, 0x2a, 0xe2, 0x24, 0x23,
+ 0x27, 0x4e, 0x58, 0xa0, 0x82, 0x1c, 0xc5, 0x50,
+ 0x2e, 0x2d, 0x0a, 0xb4, 0x58, 0x5e, 0x94, 0xde,
+
+ 0x69, 0x75, 0xbe, 0x5e, 0x0b, 0x4e, 0xfc, 0xe5,
+ 0x1c, 0xd3, 0xe7, 0x0c, 0x25, 0xa1, 0xfb, 0xbb,
+ 0xd6, 0x09, 0xd2, 0x73, 0xad, 0x5b, 0x0d, 0x59,
+ 0x63, 0x1c, 0x53, 0x1f, 0x6a, 0x0a, 0x57, 0xb9,
+};
+
+/*
+ * XTS-AES-128 applied for a data unit that is not a multiple of 16 bytes
+ */
+
+/* Vector 15 */
+static const uint8_t ciph_data_aes_xts_vect15_key1[] = {
+ 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
+ 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0,
+};
+static const uint8_t ciph_data_aes_xts_vect15_key2[] = {
+ 0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8,
+ 0xb7, 0xb6, 0xb5, 0xb4, 0xb3, 0xb2, 0xb1, 0xb0,
+};
+static const uint8_t ciph_data_aes_xts_vect15_iv[16] = {
+ 0x9a, 0x78, 0x56, 0x34, 0x12
+};
+static const uint8_t ciph_data_aes_xts_vect15_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10
+};
+static const uint8_t ciph_data_aes_xts_vect15_ctx[] = {
+ 0x6c, 0x16, 0x25, 0xdb, 0x46, 0x71, 0x52, 0x2d,
+ 0x3d, 0x75, 0x99, 0x60, 0x1d, 0xe7, 0xca, 0x09,
+ 0xed
+};
+
+/* Vector 16 */
+static const uint8_t ciph_data_aes_xts_vect16_key1[] = {
+ 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
+ 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0,
+};
+static const uint8_t ciph_data_aes_xts_vect16_key2[] = {
+ 0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8,
+ 0xb7, 0xb6, 0xb5, 0xb4, 0xb3, 0xb2, 0xb1, 0xb0,
+};
+static const uint8_t ciph_data_aes_xts_vect16_iv[16] = {
+ 0x9a, 0x78, 0x56, 0x34, 0x12
+};
+static const uint8_t ciph_data_aes_xts_vect16_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11
+};
+static const uint8_t ciph_data_aes_xts_vect16_ctx[] = {
+ 0xd0, 0x69, 0x44, 0x4b, 0x7a, 0x7e, 0x0c, 0xab,
+ 0x09, 0xe2, 0x44, 0x47, 0xd2, 0x4d, 0xeb, 0x1f,
+ 0xed, 0xbf
+};
+
+/* Vector 17 */
+static const uint8_t ciph_data_aes_xts_vect17_key1[] = {
+ 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
+ 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0,
+};
+static const uint8_t ciph_data_aes_xts_vect17_key2[] = {
+ 0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8,
+ 0xb7, 0xb6, 0xb5, 0xb4, 0xb3, 0xb2, 0xb1, 0xb0,
+};
+static const uint8_t ciph_data_aes_xts_vect17_iv[16] = {
+ 0x9a, 0x78, 0x56, 0x34, 0x12
+};
+static const uint8_t ciph_data_aes_xts_vect17_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12
+};
+static const uint8_t ciph_data_aes_xts_vect17_ctx[] = {
+ 0xe5, 0xdf, 0x13, 0x51, 0xc0, 0x54, 0x4b, 0xa1,
+ 0x35, 0x0b, 0x33, 0x63, 0xcd, 0x8e, 0xf4, 0xbe,
+ 0xed, 0xbf, 0x9d
+};
+
+/* Vector 18 */
+static const uint8_t ciph_data_aes_xts_vect18_key1[] = {
+ 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
+ 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0,
+};
+static const uint8_t ciph_data_aes_xts_vect18_key2[] = {
+ 0xbf, 0xbe, 0xbd, 0xbc, 0xbb, 0xba, 0xb9, 0xb8,
+ 0xb7, 0xb6, 0xb5, 0xb4, 0xb3, 0xb2, 0xb1, 0xb0,
+};
+static const uint8_t ciph_data_aes_xts_vect18_iv[16] = {
+ 0x9a, 0x78, 0x56, 0x34, 0x12
+};
+static const uint8_t ciph_data_aes_xts_vect18_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13
+};
+static const uint8_t ciph_data_aes_xts_vect18_ctx[] = {
+ 0x9d, 0x84, 0xc8, 0x13, 0xf7, 0x19, 0xaa, 0x2c,
+ 0x7b, 0xe3, 0xf6, 0x61, 0x71, 0xc7, 0xc5, 0xc2,
+ 0xed, 0xbf, 0x9d, 0xac
+};
+
+/* Vector 19 */
+static const uint8_t ciph_data_aes_xts_vect19_key1[] = {
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+};
+static const uint8_t ciph_data_aes_xts_vect19_key2[] = {
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+};
+static const uint8_t ciph_data_aes_xts_vect19_iv[16] = {
+ 0x21, 0x43, 0x65, 0x87, 0xa9
+};
+static const uint8_t ciph_data_aes_xts_vect19_ptx[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d,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0x1b, 0xa4, 0x66, 0xa8, 0x3b, 0xaf,
+
+ 0x92, 0xce, 0xfc, 0x15, 0x1b, 0x5c, 0xc1, 0x61,
+ 0x1a, 0x16, 0x78, 0x93, 0x81, 0x9b, 0x63, 0xfb,
+ 0x8a, 0x6b, 0x18, 0xe8, 0x6d, 0xe6, 0x02, 0x90,
+ 0xfa, 0x72, 0xb7, 0x97, 0xb0, 0xce, 0x59, 0xf3,
+};
+
+/* AES-CCM test data from NIST Special Publication 800-38C */
+
+/*
+ * Example1:
+ * K: 40414243 44454647 48494a4b 4c4d4e4f
+ * N: 10111213 141516
+ * A: 00010203 04050607
+ * P: 20212223
+ * B: 4f101112 13141516 00000000 00000004
+ * 00080001 02030405 06070000 00000000
+ * 20212223 00000000 00000000 00000000
+ * T: 6084341b
+ * Ctr0: 07101112 13141516 00000000 00000000
+ * S0: 2d281146 10676c26 32bad748 559a679a
+ * Ctr1: 07101112 13141516 00000000 00000001
+ * S1: 51432378 e474b339 71318484 103cddfb
+ * C: 7162015b 4dac255d
+ */
+static const uint8_t ae_data_aes_ccm_vect1_key[] = {
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f
+};
+static const uint8_t ae_data_aes_ccm_vect1_nonce[] = {
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16
+};
+static const uint8_t ae_data_aes_ccm_vect1_aad[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
+};
+static const uint8_t ae_data_aes_ccm_vect1_ptx[] = {
+ 0x20, 0x21, 0x22, 0x23
+};
+static const uint8_t ae_data_aes_ccm_vect1_ctx[] = {
+ 0x71, 0x62, 0x01, 0x5b,
+};
+static const uint8_t ae_data_aes_ccm_vect1_tag[] = {
+ 0x4d, 0xac, 0x25, 0x5d
+};
+
+/*
+ * Example 2:
+ * K: 40414243 44454647 48494a4b 4c4d4e4f
+ * N: 10111213 14151617
+ * A: 00010203 04050607 08090a0b 0c0d0e0f
+ * P: 20212223 24252627 28292a2b 2c2d2e2f
+ * B: 56101112 13141516 17000000 00000010
+ * 00100001 02030405 06070809 0a0b0c0d
+ * 0e0f0000 00000000 00000000 00000000
+ * 20212223 24252627 28292a2b 2c2d2e2f
+ * T: 7f479ffc a464
+ * Ctr0: 06101112 13141516 17000000 00000000
+ * S0: 6081d043 08a97dcc 20cdcc60 bf947b78
+ * Ctr1: 06101112 13141516 17000000 00000001
+ * S1: f280d2c3 75cf7945 20335db9 2b107712
+ * C: d2a1f0e0 51ea5f62 081a7792 073d593d
+ * 1fc64fbf accd
+ */
+static const uint8_t ae_data_aes_ccm_vect2_key[] = {
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f
+};
+static const uint8_t ae_data_aes_ccm_vect2_nonce[] = {
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17
+};
+static const uint8_t ae_data_aes_ccm_vect2_aad[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+};
+static const uint8_t ae_data_aes_ccm_vect2_ptx[] = {
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f
+};
+static const uint8_t ae_data_aes_ccm_vect2_ctx[] = {
+ 0xd2, 0xa1, 0xf0, 0xe0, 0x51, 0xea, 0x5f, 0x62,
+ 0x08, 0x1a, 0x77, 0x92, 0x07, 0x3d, 0x59, 0x3d,
+};
+static const uint8_t ae_data_aes_ccm_vect2_tag[] = {
+ 0x1f, 0xc6, 0x4f, 0xbf, 0xac, 0xcd
+};
+
+/*
+ * Example 3
+ * K: 40414243 44454647 48494a4b 4c4d4e4f
+ * N: 10111213 14151617 18191a1b
+ * A: 00010203 04050607 08090a0b 0c0d0e0f
+ * 10111213
+ * P: 20212223 24252627 28292a2b 2c2d2e2f
+ * 30313233 34353637
+ * B: 5a101112 13141516 1718191a 1b000018
+ * 00140001 02030405 06070809 0a0b0c0d
+ * 0e0f1011 12130000 00000000 00000000
+ * 20212223 24252627 28292a2b 2c2d2e2f
+ * 30313233 34353637 00000000 00000000
+ * T: 67c99240 c7d51048
+ * Ctr0: 02101112 13141516 1718191a 1b000000
+ * S0: 2f8a00bb 06658919 c3a040a6 eaed1a7f
+ * Ctr1: 02101112 13141516 1718191a 1b000001
+ * S1: c393238a d1923c5d b335c0c7 e1bac924
+ * Ctr2: 02101112 13141516 1718191a 1b000002
+ * S2: 514798ea 9077bc92 6c22ebef 2ac732dc
+ * C: e3b201a9 f5b71a7a 9b1ceaec cd97e70b
+ * 6176aad9 a4428aa5 484392fb c1b09951
+ */
+static const uint8_t ae_data_aes_ccm_vect3_key[] = {
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f
+};
+static const uint8_t ae_data_aes_ccm_vect3_nonce[] = {
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b
+};
+static const uint8_t ae_data_aes_ccm_vect3_aad[] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13
+};
+static const uint8_t ae_data_aes_ccm_vect3_ptx[] = {
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37
+};
+static const uint8_t ae_data_aes_ccm_vect3_ctx[] = {
+ 0xe3, 0xb2, 0x01, 0xa9, 0xf5, 0xb7, 0x1a, 0x7a,
+ 0x9b, 0x1c, 0xea, 0xec, 0xcd, 0x97, 0xe7, 0x0b,
+ 0x61, 0x76, 0xaa, 0xd9, 0xa4, 0x42, 0x8a, 0xa5,
+};
+static const uint8_t ae_data_aes_ccm_vect3_tag[] = {
+ 0x48, 0x43, 0x92, 0xfb, 0xc1, 0xb0, 0x99, 0x51
+};
+
+/*
+ * AES-GCM vectors from the reviced "The Galois/Counter Mode of Operation
+ * (GCM)" 2005-05-31 spec
+ */
+
+/*
+ * Test case 1
+ * K 00000000000000000000000000000000
+ * P
+ * IV 000000000000000000000000
+ * H 66e94bd4ef8a2c3b884cfa59ca342b2e
+ * Y0 00000000000000000000000000000001
+ * E(K, Y0) 58e2fccefa7e3061367f1d57a4e7455a
+ * len(A)||len(C) 00000000000000000000000000000000
+ * GHASH(H, A, C) 00000000000000000000000000000000
+ * C
+ * T 58e2fccefa7e3061367f1d57a4e7455a
+ */
+static const uint8_t ae_data_aes_gcm_vect1_key[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+static const uint8_t ae_data_aes_gcm_vect1_nonce[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+};
+#define ae_data_aes_gcm_vect1_aad NULL
+#define ae_data_aes_gcm_vect1_ptx NULL
+#define ae_data_aes_gcm_vect1_ctx NULL
+static const uint8_t ae_data_aes_gcm_vect1_tag[] = {
+ 0x58, 0xe2, 0xfc, 0xce, 0xfa, 0x7e, 0x30, 0x61,
+ 0x36, 0x7f, 0x1d, 0x57, 0xa4, 0xe7, 0x45, 0x5a
+};
+
+/*
+ * Test case 2
+ * K 00000000000000000000000000000000
+ * P 00000000000000000000000000000000
+ * IV 000000000000000000000000
+ * H 66e94bd4ef8a2c3b884cfa59ca342b2e
+ * Y0 00000000000000000000000000000001
+ * E(K, Y0) 58e2fccefa7e3061367f1d57a4e7455a
+ * Y1 00000000000000000000000000000002
+ * E(K, Y1) 0388dace60b6a392f328c2b971b2fe78
+ * X1 5e2ec746917062882c85b0685353deb7
+ * len(A)||len(C) 00000000000000000000000000000080
+ * GHASH(H, A, C) f38cbb1ad69223dcc3457ae5b6b0f885
+ * C 0388dace60b6a392f328c2b971b2fe78
+ * T ab6e47d42cec13bdf53a67b21257bddf
+ */
+
+static const uint8_t ae_data_aes_gcm_vect2_key[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+static const uint8_t ae_data_aes_gcm_vect2_nonce[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+};
+#define ae_data_aes_gcm_vect2_aad NULL
+static const uint8_t ae_data_aes_gcm_vect2_ptx[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+static const uint8_t ae_data_aes_gcm_vect2_ctx[] = {
+ 0x03, 0x88, 0xda, 0xce, 0x60, 0xb6, 0xa3, 0x92,
+ 0xf3, 0x28, 0xc2, 0xb9, 0x71, 0xb2, 0xfe, 0x78
+};
+static const uint8_t ae_data_aes_gcm_vect2_tag[] = {
+ 0xab, 0x6e, 0x47, 0xd4, 0x2c, 0xec, 0x13, 0xbd,
+ 0xf5, 0x3a, 0x67, 0xb2, 0x12, 0x57, 0xbd, 0xdf
+};
+
+/*
+ * Test case 3
+ * K feffe9928665731c6d6a8f9467308308
+ * P d9313225f88406e5a55909c5aff5269a
+ * 86a7a9531534f7da2e4c303d8a318a72
+ * 1c3c0c95956809532fcf0e2449a6b525
+ * b16aedf5aa0de657ba637b391aafd255
+ * IV cafebabefacedbaddecaf888
+ * H b83b533708bf535d0aa6e52980d53b78
+ * Y0 cafebabefacedbaddecaf88800000001
+ * E(K, Y0) 3247184b3c4f69a44dbcd22887bbb418
+ * Y1 cafebabefacedbaddecaf88800000002
+ * E(K, Y1) 9bb22ce7d9f372c1ee2b28722b25f206
+ * Y2 cafebabefacedbaddecaf88800000003
+ * E(K, Y2) 650d887c3936533a1b8d4e1ea39d2b5c
+ * Y3 cafebabefacedbaddecaf88800000004
+ * E(K, Y3) 3de91827c10e9a4f5240647ee5221f20
+ * Y4 cafebabefacedbaddecaf88800000005
+ * E(K, Y4) aac9e6ccc0074ac0873b9ba85d908bd0
+ * X1 59ed3f2bb1a0aaa07c9f56c6a504647b
+ * X2 b714c9048389afd9f9bc5c1d4378e052
+ * X3 47400c6577b1ee8d8f40b2721e86ff10
+ * X4 4796cf49464704b5dd91f159bb1b7f95
+ * len(A)||len(C) 00000000000000000000000000000200
+ * GHASH(H, A, C) 7f1b32b81b820d02614f8895ac1d4eac
+ * C 42831ec2217774244b7221b784d0d49c
+ * e3aa212f2c02a4e035c17e2329aca12e
+ * 21d514b25466931c7d8f6a5aac84aa05
+ * 1ba30b396a0aac973d58e091473f5985
+ * T 4d5c2af327cd64a62cf35abd2ba6fab4
+ */
+
+static const uint8_t ae_data_aes_gcm_vect3_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
+};
+static const uint8_t ae_data_aes_gcm_vect3_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88
+};
+#define ae_data_aes_gcm_vect3_aad NULL
+static const uint8_t ae_data_aes_gcm_vect3_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55
+};
+static const uint8_t ae_data_aes_gcm_vect3_ctx[] = {
+ 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24,
+ 0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c,
+ 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0,
+ 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e,
+ 0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c,
+ 0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05,
+ 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97,
+ 0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85
+};
+static const uint8_t ae_data_aes_gcm_vect3_tag[] = {
+ 0x4d, 0x5c, 0x2a, 0xf3, 0x27, 0xcd, 0x64, 0xa6,
+ 0x2c, 0xf3, 0x5a, 0xbd, 0x2b, 0xa6, 0xfa, 0xb4
+};
+
+/*
+ * Test case 4
+ * K feffe9928665731c6d6a8f9467308308
+ * P d9313225f88406e5a55909c5aff5269a
+ * 86a7a9531534f7da2e4c303d8a318a72
+ * 1c3c0c95956809532fcf0e2449a6b525
+ * b16aedf5aa0de657ba637b39
+ * A feedfacedeadbeeffeedfacedeadbeef
+ * abaddad2
+ * IV cafebabefacedbaddecaf888
+ * H b83b533708bf535d0aa6e52980d53b78
+ * Y0 cafebabefacedbaddecaf88800000001
+ * E(K, Y0) 3247184b3c4f69a44dbcd22887bbb418
+ * X1 ed56aaf8a72d67049fdb9228edba1322
+ * X2 cd47221ccef0554ee4bb044c88150352
+ * Y1 cafebabefacedbaddecaf88800000002
+ * E(K, Y1) 9bb22ce7d9f372c1ee2b28722b25f206
+ * Y2 cafebabefacedbaddecaf88800000003
+ * E(K, Y2) 650d887c3936533a1b8d4e1ea39d2b5c
+ * Y3 cafebabefacedbaddecaf88800000004
+ * E(K, Y3) 3de91827c10e9a4f5240647ee5221f20
+ * Y4 cafebabefacedbaddecaf88800000005
+ * E(K, Y4) aac9e6ccc0074ac0873b9ba85d908bd0
+ * X3 54f5e1b2b5a8f9525c23924751a3ca51
+ * X4 324f585c6ffc1359ab371565d6c45f93
+ * X5 ca7dd446af4aa70cc3c0cd5abba6aa1c
+ * X6 1590df9b2eb6768289e57d56274c8570
+ * len(A)||len(C) 00000000000000a000000000000001e0
+ * GHASH(H, A, C) 698e57f70e6ecc7fd9463b7260a9ae5f
+ * C 42831ec2217774244b7221b784d0d49c
+ * e3aa212f2c02a4e035c17e2329aca12e
+ * 21d514b25466931c7d8f6a5aac84aa05
+ * 1ba30b396a0aac973d58e091
+ * T 5bc94fbc3221a5db94fae95ae7121a47
+ */
+
+static const uint8_t ae_data_aes_gcm_vect4_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
+};
+static const uint8_t ae_data_aes_gcm_vect4_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88
+};
+static const uint8_t ae_data_aes_gcm_vect4_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2
+};
+static const uint8_t ae_data_aes_gcm_vect4_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39
+};
+static const uint8_t ae_data_aes_gcm_vect4_ctx[] = {
+ 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24,
+ 0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c,
+ 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0,
+ 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e,
+ 0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c,
+ 0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05,
+ 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97,
+ 0x3d, 0x58, 0xe0, 0x91
+};
+static const uint8_t ae_data_aes_gcm_vect4_tag[] = {
+ 0x5b, 0xc9, 0x4f, 0xbc, 0x32, 0x21, 0xa5, 0xdb,
+ 0x94, 0xfa, 0xe9, 0x5a, 0xe7, 0x12, 0x1a, 0x47
+};
+
+/*
+ * Test case 5
+ * K feffe9928665731c6d6a8f9467308308
+ * P d9313225f88406e5a55909c5aff5269a
+ * 86a7a9531534f7da2e4c303d8a318a72
+ * 1c3c0c95956809532fcf0e2449a6b525
+ * b16aedf5aa0de657ba637b39
+ * A feedfacedeadbeeffeedfacedeadbeef
+ * abaddad2
+ * IV cafebabefacedbad
+ * H b83b533708bf535d0aa6e52980d53b78
+ * N1 6f288b846e5fed9a18376829c86a6a16
+ * len({})||len(IV ) 00000000000000000000000000000040
+ * Y0 c43a83c4c4badec4354ca984db252f7d
+ * E(K, Y0) e94ab9535c72bea9e089c93d48e62fb0
+ * X1 ed56aaf8a72d67049fdb9228edba1322
+ * X2 cd47221ccef0554ee4bb044c88150352
+ * Y1 c43a83c4c4badec4354ca984db252f7e
+ * E(K, Y1) b8040969d08295afd226fcda0ddf61cf
+ * Y2 c43a83c4c4badec4354ca984db252f7f
+ * E(K, Y2) ef3c83225af93122192ad5c4f15dfe51
+ * Y3 c43a83c4c4badec4354ca984db252f80
+ * E(K, Y3) 6fbc659571f72de104c67b609d2fde67
+ * Y4 c43a83c4c4badec4354ca984db252f81
+ * E(K, Y4) f8e3581441a1e950785c3ea1430c6fa6
+ * X3 9379e2feae14649c86cf2250e3a81916
+ * X4 65dde904c92a6b3db877c4817b50a5f4
+ * X5 48c53cf863b49a1b0bbfc48c3baaa89d
+ * X6 08c873f1c8cec3effc209a07468caab1
+ * len(A)||len(C) 00000000000000a000000000000001e0
+ * GHASH(H, A, C) df586bb4c249b92cb6922877e444d37b
+ * C 61353b4c2806934a777ff51fa22a4755
+ * 699b2a714fcdc6f83766e5f97b6c7423
+ * 73806900e49f24b22b097544d4896b42
+ * 4989b5e1ebac0f07c23f4598
+ * T 3612d2e79e3b0785561be14aaca2fccb
+ */
+
+static const uint8_t ae_data_aes_gcm_vect5_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
+};
+static const uint8_t ae_data_aes_gcm_vect5_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad
+};
+static const uint8_t ae_data_aes_gcm_vect5_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2
+};
+static const uint8_t ae_data_aes_gcm_vect5_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39
+};
+static const uint8_t ae_data_aes_gcm_vect5_ctx[] = {
+ 0x61, 0x35, 0x3b, 0x4c, 0x28, 0x06, 0x93, 0x4a,
+ 0x77, 0x7f, 0xf5, 0x1f, 0xa2, 0x2a, 0x47, 0x55,
+ 0x69, 0x9b, 0x2a, 0x71, 0x4f, 0xcd, 0xc6, 0xf8,
+ 0x37, 0x66, 0xe5, 0xf9, 0x7b, 0x6c, 0x74, 0x23,
+ 0x73, 0x80, 0x69, 0x00, 0xe4, 0x9f, 0x24, 0xb2,
+ 0x2b, 0x09, 0x75, 0x44, 0xd4, 0x89, 0x6b, 0x42,
+ 0x49, 0x89, 0xb5, 0xe1, 0xeb, 0xac, 0x0f, 0x07,
+ 0xc2, 0x3f, 0x45, 0x98
+};
+static const uint8_t ae_data_aes_gcm_vect5_tag[] = {
+ 0x36, 0x12, 0xd2, 0xe7, 0x9e, 0x3b, 0x07, 0x85,
+ 0x56, 0x1b, 0xe1, 0x4a, 0xac, 0xa2, 0xfc, 0xcb
+};
+
+/*
+ * Test case 6
+ * K feffe9928665731c6d6a8f9467308308
+ * P d9313225f88406e5a55909c5aff5269a
+ * 86a7a9531534f7da2e4c303d8a318a72
+ * 1c3c0c95956809532fcf0e2449a6b525
+ * b16aedf5aa0de657ba637b39
+ * A feedfacedeadbeeffeedfacedeadbeef
+ * abaddad2
+ * IV 9313225df88406e555909c5aff5269aa
+ * 6a7a9538534f7da1e4c303d2a318a728
+ * c3c0c95156809539fcf0e2429a6b5254
+ * 16aedbf5a0de6a57a637b39b
+ * H b83b533708bf535d0aa6e52980d53b78
+ * N1 004d6599d7fb1634756e1e299d81630f
+ * N2 88ffe8a3c8033df4b54d732f7f88408e
+ * N3 24e694cfab657beabba8055aad495e23
+ * N4 d8349a5eda24943c8fbb2ef5168b20cb
+ * len({})||len(IV ) 000000000000000000000000000001e0
+ * Y0 3bab75780a31c059f83d2a44752f9864
+ * E(K, Y0) 7dc63b399f2d98d57ab073b6baa4138e
+ * X1 ed56aaf8a72d67049fdb9228edba1322
+ * X2 cd47221ccef0554ee4bb044c88150352
+ * Y1 3bab75780a31c059f83d2a44752f9865
+ * E(K, Y1) 55d37bbd9ad21353a6f93a690eca9e0e
+ * Y2 3bab75780a31c059f83d2a44752f9866
+ * E(K, Y2) 3836bbf6d696e672946a1a01404fa6d5
+ * Y3 3bab75780a31c059f83d2a44752f9867
+ * E(K, Y3) 1dd8a5316ecc35c3e313bca59d2ac94a
+ * Y4 3bab75780a31c059f83d2a44752f9868
+ * E(K, Y4) 6742982706a9f154f657d5dc94b746db
+ * X3 31727669c63c6f078b5d22adbbbca384
+ * X4 480c00db2679065a7ed2f771a53acacd
+ * X5 1c1ae3c355e2214466a9923d2ba6ab35
+ * X6 0694c6f16bb0275a48891d06590344b0
+ * len(A)||len(C) 00000000000000a000000000000001e0
+ * GHASH(H, A, C) 1c5afe9760d3932f3c9a878aac3dc3de
+ * C 8ce24998625615b603a033aca13fb894
+ * be9112a5c3a211a8ba262a3cca7e2ca7
+ * 01e4a9a4fba43c90ccdcb281d48c7c6f
+ * d62875d2aca417034c34aee5
+ * T 619cc5aefffe0bfa462af43c1699d050
+ */
+
+static const uint8_t ae_data_aes_gcm_vect6_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+};
+static const uint8_t ae_data_aes_gcm_vect6_nonce[] = {
+ 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
+ 0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
+ 0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1,
+ 0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28,
+ 0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39,
+ 0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54,
+ 0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57,
+ 0xa6, 0x37, 0xb3, 0x9b,
+};
+static const uint8_t ae_data_aes_gcm_vect6_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2,
+};
+static const uint8_t ae_data_aes_gcm_vect6_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39,
+};
+static const uint8_t ae_data_aes_gcm_vect6_ctx[] = {
+ 0x8c, 0xe2, 0x49, 0x98, 0x62, 0x56, 0x15, 0xb6,
+ 0x03, 0xa0, 0x33, 0xac, 0xa1, 0x3f, 0xb8, 0x94,
+ 0xbe, 0x91, 0x12, 0xa5, 0xc3, 0xa2, 0x11, 0xa8,
+ 0xba, 0x26, 0x2a, 0x3c, 0xca, 0x7e, 0x2c, 0xa7,
+ 0x01, 0xe4, 0xa9, 0xa4, 0xfb, 0xa4, 0x3c, 0x90,
+ 0xcc, 0xdc, 0xb2, 0x81, 0xd4, 0x8c, 0x7c, 0x6f,
+ 0xd6, 0x28, 0x75, 0xd2, 0xac, 0xa4, 0x17, 0x03,
+ 0x4c, 0x34, 0xae, 0xe5,
+};
+static const uint8_t ae_data_aes_gcm_vect6_tag[] = {
+ 0x61, 0x9c, 0xc5, 0xae, 0xff, 0xfe, 0x0b, 0xfa,
+ 0x46, 0x2a, 0xf4, 0x3c, 0x16, 0x99, 0xd0, 0x50,
+};
+
+/*
+ * Test case 7
+ * K 00000000000000000000000000000000
+ * 0000000000000000
+ * P
+ * IV 000000000000000000000000
+ * H aae06992acbf52a3e8f4a96ec9300bd7
+ * Y0 00000000000000000000000000000001
+ * E(K, Y0) cd33b28ac773f74ba00ed1f312572435
+ * len(A)||len(C) 00000000000000000000000000000000
+ * GHASH(H, A, C) 00000000000000000000000000000000
+ * C
+ * T cd33b28ac773f74ba00ed1f312572435
+ */
+
+static const uint8_t ae_data_aes_gcm_vect7_key[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const uint8_t ae_data_aes_gcm_vect7_nonce[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+};
+#define ae_data_aes_gcm_vect7_aad NULL
+#define ae_data_aes_gcm_vect7_ptx NULL
+#define ae_data_aes_gcm_vect7_ctx NULL
+static const uint8_t ae_data_aes_gcm_vect7_tag[] = {
+ 0xcd, 0x33, 0xb2, 0x8a, 0xc7, 0x73, 0xf7, 0x4b,
+ 0xa0, 0x0e, 0xd1, 0xf3, 0x12, 0x57, 0x24, 0x35,
+};
+
+/*
+ * Test case 8
+ * K 00000000000000000000000000000000
+ * 0000000000000000
+ * P 00000000000000000000000000000000
+ * IV 000000000000000000000000
+ * H aae06992acbf52a3e8f4a96ec9300bd7
+ * Y0 00000000000000000000000000000001
+ * E(K, Y0) cd33b28ac773f74ba00ed1f312572435
+ * Y1 00000000000000000000000000000002
+ * E(K, Y1) 98e7247c07f0fe411c267e4384b0f600
+ * X1 90e87315fb7d4e1b4092ec0cbfda5d7d
+ * len(A)||len(C) 00000000000000000000000000000080
+ * GHASH(H, A, C) e2c63f0ac44ad0e02efa05ab6743d4ce
+ * C 98e7247c07f0fe411c267e4384b0f600
+ * T 2ff58d80033927ab8ef4d4587514f0fb
+ */
+
+static const uint8_t ae_data_aes_gcm_vect8_key[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const uint8_t ae_data_aes_gcm_vect8_nonce[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+};
+#define ae_data_aes_gcm_vect8_aad NULL
+static const uint8_t ae_data_aes_gcm_vect8_ptx[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const uint8_t ae_data_aes_gcm_vect8_ctx[] = {
+ 0x98, 0xe7, 0x24, 0x7c, 0x07, 0xf0, 0xfe, 0x41,
+ 0x1c, 0x26, 0x7e, 0x43, 0x84, 0xb0, 0xf6, 0x00,
+};
+static const uint8_t ae_data_aes_gcm_vect8_tag[] = {
+ 0x2f, 0xf5, 0x8d, 0x80, 0x03, 0x39, 0x27, 0xab,
+ 0x8e, 0xf4, 0xd4, 0x58, 0x75, 0x14, 0xf0, 0xfb,
+};
+
+/* Test case 9 */
+static const uint8_t ae_data_aes_gcm_vect9_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+};
+static const uint8_t ae_data_aes_gcm_vect9_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88,
+};
+#define ae_data_aes_gcm_vect9_aad NULL
+static const uint8_t ae_data_aes_gcm_vect9_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55,
+};
+static const uint8_t ae_data_aes_gcm_vect9_ctx[] = {
+ 0x39, 0x80, 0xca, 0x0b, 0x3c, 0x00, 0xe8, 0x41,
+ 0xeb, 0x06, 0xfa, 0xc4, 0x87, 0x2a, 0x27, 0x57,
+ 0x85, 0x9e, 0x1c, 0xea, 0xa6, 0xef, 0xd9, 0x84,
+ 0x62, 0x85, 0x93, 0xb4, 0x0c, 0xa1, 0xe1, 0x9c,
+ 0x7d, 0x77, 0x3d, 0x00, 0xc1, 0x44, 0xc5, 0x25,
+ 0xac, 0x61, 0x9d, 0x18, 0xc8, 0x4a, 0x3f, 0x47,
+ 0x18, 0xe2, 0x44, 0x8b, 0x2f, 0xe3, 0x24, 0xd9,
+ 0xcc, 0xda, 0x27, 0x10, 0xac, 0xad, 0xe2, 0x56,
+};
+static const uint8_t ae_data_aes_gcm_vect9_tag[] = {
+ 0x99, 0x24, 0xa7, 0xc8, 0x58, 0x73, 0x36, 0xbf,
+ 0xb1, 0x18, 0x02, 0x4d, 0xb8, 0x67, 0x4a, 0x14,
+};
+
+/* Test case 10 */
+static const uint8_t ae_data_aes_gcm_vect10_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+};
+static const uint8_t ae_data_aes_gcm_vect10_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88,
+};
+static const uint8_t ae_data_aes_gcm_vect10_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2,
+};
+static const uint8_t ae_data_aes_gcm_vect10_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39,
+};
+static const uint8_t ae_data_aes_gcm_vect10_ctx[] = {
+ 0x39, 0x80, 0xca, 0x0b, 0x3c, 0x00, 0xe8, 0x41,
+ 0xeb, 0x06, 0xfa, 0xc4, 0x87, 0x2a, 0x27, 0x57,
+ 0x85, 0x9e, 0x1c, 0xea, 0xa6, 0xef, 0xd9, 0x84,
+ 0x62, 0x85, 0x93, 0xb4, 0x0c, 0xa1, 0xe1, 0x9c,
+ 0x7d, 0x77, 0x3d, 0x00, 0xc1, 0x44, 0xc5, 0x25,
+ 0xac, 0x61, 0x9d, 0x18, 0xc8, 0x4a, 0x3f, 0x47,
+ 0x18, 0xe2, 0x44, 0x8b, 0x2f, 0xe3, 0x24, 0xd9,
+ 0xcc, 0xda, 0x27, 0x10,
+};
+static const uint8_t ae_data_aes_gcm_vect10_tag[] = {
+ 0x25, 0x19, 0x49, 0x8e, 0x80, 0xf1, 0x47, 0x8f,
+ 0x37, 0xba, 0x55, 0xbd, 0x6d, 0x27, 0x61, 0x8c,
+};
+
+/* Test case 11 */
+static const uint8_t ae_data_aes_gcm_vect11_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+};
+static const uint8_t ae_data_aes_gcm_vect11_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+};
+static const uint8_t ae_data_aes_gcm_vect11_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2,
+};
+static const uint8_t ae_data_aes_gcm_vect11_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39,
+};
+static const uint8_t ae_data_aes_gcm_vect11_ctx[] = {
+ 0x0f, 0x10, 0xf5, 0x99, 0xae, 0x14, 0xa1, 0x54,
+ 0xed, 0x24, 0xb3, 0x6e, 0x25, 0x32, 0x4d, 0xb8,
+ 0xc5, 0x66, 0x63, 0x2e, 0xf2, 0xbb, 0xb3, 0x4f,
+ 0x83, 0x47, 0x28, 0x0f, 0xc4, 0x50, 0x70, 0x57,
+ 0xfd, 0xdc, 0x29, 0xdf, 0x9a, 0x47, 0x1f, 0x75,
+ 0xc6, 0x65, 0x41, 0xd4, 0xd4, 0xda, 0xd1, 0xc9,
+ 0xe9, 0x3a, 0x19, 0xa5, 0x8e, 0x8b, 0x47, 0x3f,
+ 0xa0, 0xf0, 0x62, 0xf7,
+};
+static const uint8_t ae_data_aes_gcm_vect11_tag[] = {
+ 0x65, 0xdc, 0xc5, 0x7f, 0xcf, 0x62, 0x3a, 0x24,
+ 0x09, 0x4f, 0xcc, 0xa4, 0x0d, 0x35, 0x33, 0xf8,
+};
+
+/* Test case 12 */
+static const uint8_t ae_data_aes_gcm_vect12_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+};
+static const uint8_t ae_data_aes_gcm_vect12_nonce[] = {
+ 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
+ 0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
+ 0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1,
+ 0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28,
+ 0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39,
+ 0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54,
+ 0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57,
+ 0xa6, 0x37, 0xb3, 0x9b,
+};
+static const uint8_t ae_data_aes_gcm_vect12_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2,
+};
+static const uint8_t ae_data_aes_gcm_vect12_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39,
+};
+static const uint8_t ae_data_aes_gcm_vect12_ctx[] = {
+ 0xd2, 0x7e, 0x88, 0x68, 0x1c, 0xe3, 0x24, 0x3c,
+ 0x48, 0x30, 0x16, 0x5a, 0x8f, 0xdc, 0xf9, 0xff,
+ 0x1d, 0xe9, 0xa1, 0xd8, 0xe6, 0xb4, 0x47, 0xef,
+ 0x6e, 0xf7, 0xb7, 0x98, 0x28, 0x66, 0x6e, 0x45,
+ 0x81, 0xe7, 0x90, 0x12, 0xaf, 0x34, 0xdd, 0xd9,
+ 0xe2, 0xf0, 0x37, 0x58, 0x9b, 0x29, 0x2d, 0xb3,
+ 0xe6, 0x7c, 0x03, 0x67, 0x45, 0xfa, 0x22, 0xe7,
+ 0xe9, 0xb7, 0x37, 0x3b,
+};
+static const uint8_t ae_data_aes_gcm_vect12_tag[] = {
+ 0xdc, 0xf5, 0x66, 0xff, 0x29, 0x1c, 0x25, 0xbb,
+ 0xb8, 0x56, 0x8f, 0xc3, 0xd3, 0x76, 0xa6, 0xd9,
+};
+
+/* Test case 13 */
+static const uint8_t ae_data_aes_gcm_vect13_key[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const uint8_t ae_data_aes_gcm_vect13_nonce[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+};
+#define ae_data_aes_gcm_vect13_aad NULL
+#define ae_data_aes_gcm_vect13_ptx NULL
+#define ae_data_aes_gcm_vect13_ctx NULL
+static const uint8_t ae_data_aes_gcm_vect13_tag[] = {
+ 0x53, 0x0f, 0x8a, 0xfb, 0xc7, 0x45, 0x36, 0xb9,
+ 0xa9, 0x63, 0xb4, 0xf1, 0xc4, 0xcb, 0x73, 0x8b,
+};
+
+/* Test case 14 */
+static const uint8_t ae_data_aes_gcm_vect14_key[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const uint8_t ae_data_aes_gcm_vect14_nonce[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+};
+#define ae_data_aes_gcm_vect14_aad NULL
+static const uint8_t ae_data_aes_gcm_vect14_ptx[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const uint8_t ae_data_aes_gcm_vect14_ctx[] = {
+ 0xce, 0xa7, 0x40, 0x3d, 0x4d, 0x60, 0x6b, 0x6e,
+ 0x07, 0x4e, 0xc5, 0xd3, 0xba, 0xf3, 0x9d, 0x18,
+};
+static const uint8_t ae_data_aes_gcm_vect14_tag[] = {
+ 0xd0, 0xd1, 0xc8, 0xa7, 0x99, 0x99, 0x6b, 0xf0,
+ 0x26, 0x5b, 0x98, 0xb5, 0xd4, 0x8a, 0xb9, 0x19,
+};
+
+/* Test case 15 */
+static const uint8_t ae_data_aes_gcm_vect15_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+};
+static const uint8_t ae_data_aes_gcm_vect15_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88,
+};
+#define ae_data_aes_gcm_vect15_aad NULL
+static const uint8_t ae_data_aes_gcm_vect15_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55,
+};
+static const uint8_t ae_data_aes_gcm_vect15_ctx[] = {
+ 0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
+ 0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
+ 0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
+ 0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa,
+ 0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d,
+ 0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38,
+ 0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a,
+ 0xbc, 0xc9, 0xf6, 0x62, 0x89, 0x80, 0x15, 0xad,
+};
+static const uint8_t ae_data_aes_gcm_vect15_tag[] = {
+ 0xb0, 0x94, 0xda, 0xc5, 0xd9, 0x34, 0x71, 0xbd,
+ 0xec, 0x1a, 0x50, 0x22, 0x70, 0xe3, 0xcc, 0x6c,
+};
+
+/* Test case 16 */
+static const uint8_t ae_data_aes_gcm_vect16_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+};
+static const uint8_t ae_data_aes_gcm_vect16_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88,
+};
+static const uint8_t ae_data_aes_gcm_vect16_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2,
+};
+static const uint8_t ae_data_aes_gcm_vect16_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39,
+};
+static const uint8_t ae_data_aes_gcm_vect16_ctx[] = {
+ 0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
+ 0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
+ 0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
+ 0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa,
+ 0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d,
+ 0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38,
+ 0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a,
+ 0xbc, 0xc9, 0xf6, 0x62,
+};
+static const uint8_t ae_data_aes_gcm_vect16_tag[] = {
+ 0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68,
+ 0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b,
+};
+
+/* Test case 17 */
+static const uint8_t ae_data_aes_gcm_vect17_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+};
+static const uint8_t ae_data_aes_gcm_vect17_nonce[] = {
+ 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+};
+static const uint8_t ae_data_aes_gcm_vect17_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2,
+};
+static const uint8_t ae_data_aes_gcm_vect17_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39,
+};
+static const uint8_t ae_data_aes_gcm_vect17_ctx[] = {
+ 0xc3, 0x76, 0x2d, 0xf1, 0xca, 0x78, 0x7d, 0x32,
+ 0xae, 0x47, 0xc1, 0x3b, 0xf1, 0x98, 0x44, 0xcb,
+ 0xaf, 0x1a, 0xe1, 0x4d, 0x0b, 0x97, 0x6a, 0xfa,
+ 0xc5, 0x2f, 0xf7, 0xd7, 0x9b, 0xba, 0x9d, 0xe0,
+ 0xfe, 0xb5, 0x82, 0xd3, 0x39, 0x34, 0xa4, 0xf0,
+ 0x95, 0x4c, 0xc2, 0x36, 0x3b, 0xc7, 0x3f, 0x78,
+ 0x62, 0xac, 0x43, 0x0e, 0x64, 0xab, 0xe4, 0x99,
+ 0xf4, 0x7c, 0x9b, 0x1f,
+};
+static const uint8_t ae_data_aes_gcm_vect17_tag[] = {
+ 0x3a, 0x33, 0x7d, 0xbf, 0x46, 0xa7, 0x92, 0xc4,
+ 0x5e, 0x45, 0x49, 0x13, 0xfe, 0x2e, 0xa8, 0xf2,
+};
+
+/* Test case 18 */
+static const uint8_t ae_data_aes_gcm_vect18_key[] = {
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+};
+static const uint8_t ae_data_aes_gcm_vect18_nonce[] = {
+ 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
+ 0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
+ 0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1,
+ 0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28,
+ 0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39,
+ 0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54,
+ 0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57,
+ 0xa6, 0x37, 0xb3, 0x9b,
+};
+static const uint8_t ae_data_aes_gcm_vect18_aad[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
+ 0xab, 0xad, 0xda, 0xd2,
+};
+static const uint8_t ae_data_aes_gcm_vect18_ptx[] = {
+ 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
+ 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
+ 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
+ 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
+ 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
+ 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
+ 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
+ 0xba, 0x63, 0x7b, 0x39,
+};
+static const uint8_t ae_data_aes_gcm_vect18_ctx[] = {
+ 0x5a, 0x8d, 0xef, 0x2f, 0x0c, 0x9e, 0x53, 0xf1,
+ 0xf7, 0x5d, 0x78, 0x53, 0x65, 0x9e, 0x2a, 0x20,
+ 0xee, 0xb2, 0xb2, 0x2a, 0xaf, 0xde, 0x64, 0x19,
+ 0xa0, 0x58, 0xab, 0x4f, 0x6f, 0x74, 0x6b, 0xf4,
+ 0x0f, 0xc0, 0xc3, 0xb7, 0x80, 0xf2, 0x44, 0x45,
+ 0x2d, 0xa3, 0xeb, 0xf1, 0xc5, 0xd8, 0x2c, 0xde,
+ 0xa2, 0x41, 0x89, 0x97, 0x20, 0x0e, 0xf8, 0x2e,
+ 0x44, 0xae, 0x7e, 0x3f,
+};
+static const uint8_t ae_data_aes_gcm_vect18_tag[] = {
+ 0xa4, 0x4a, 0x82, 0x66, 0xee, 0x1c, 0x8e, 0xb0,
+ 0xc8, 0xb5, 0xd4, 0xcf, 0x5a, 0xe9, 0xf1, 0x9a,
+};
+
+/*
+ * Test data generated with
+ * http://www.mobilefish.com/services/rsa_key_generation/rsa_key_generation.php
+ * selecting 1024 bit key
+ */
+static const uint8_t ac_rsassa_vect1_modulus[] = {
+ 0xab, 0x42, 0x30, 0x54, 0x02, 0x15, 0x19, 0x4f, 0x03, 0x15, 0x73, 0xdf,
+ 0x96, 0x4c, 0x23, 0xeb, 0xd3, 0xd5, 0xf2, 0xff, 0x17, 0xf4, 0x1f, 0x5c,
+ 0x41, 0x26, 0x3e, 0x20, 0x15, 0x6d, 0x0a, 0x70, 0x8d, 0x9e, 0x9e, 0x67,
+ 0x47, 0x87, 0x6a, 0x15, 0xb5, 0x40, 0x38, 0x99, 0x64, 0x90, 0xc1, 0x32,
+ 0x32, 0x95, 0xc7, 0x63, 0x0a, 0xac, 0x5b, 0xcc, 0x21, 0x6b, 0x51, 0x7b,
+ 0xa5, 0xef, 0x7b, 0x62, 0x12, 0x34, 0x2d, 0x8d, 0xb6, 0x0d, 0x24, 0x92,
+ 0xa4, 0x83, 0xd4, 0x3b, 0xa5, 0x29, 0xe2, 0x94, 0xfc, 0xcd, 0x5e, 0xcb,
+ 0xc6, 0x52, 0x7b, 0xf7, 0x65, 0x80, 0x1f, 0x63, 0xcb, 0x4f, 0x40, 0x27,
+ 0x5b, 0x2d, 0x2a, 0x9f, 0xce, 0x9b, 0x33, 0x97, 0xeb, 0xbe, 0xcb, 0x34,
+ 0x22, 0xff, 0x5f, 0x21, 0x21, 0xba, 0x75, 0xb3, 0xba, 0x8f, 0x00, 0x9e,
+ 0x08, 0x66, 0x86, 0x4a, 0x8e, 0x40, 0xb2, 0x5f
+};
+static const uint8_t ac_rsassa_vect1_pub_exp[] = {
+ 0x01, 0x00, 0x01
+};
+static const uint8_t ac_rsassa_vect1_priv_exp[] = {
+ 0x91, 0xaa, 0x4f, 0xae, 0xf4, 0xc2, 0x7b, 0x6f, 0x60, 0x21, 0x1c, 0x18,
+ 0xde, 0x1e, 0xcf, 0x22, 0xe4, 0x60, 0x83, 0x3a, 0x04, 0x66, 0xc9, 0x51,
+ 0xcf, 0xbc, 0x36, 0x75, 0x55, 0xa4, 0x14, 0x90, 0x1d, 0x75, 0x00, 0x28,
+ 0xba, 0x87, 0x6c, 0x6d, 0x20, 0x68, 0x8a, 0x7b, 0xb6, 0x35, 0x05, 0x8e,
+ 0xab, 0xc6, 0x07, 0xfc, 0xae, 0xf4, 0x61, 0x74, 0x24, 0x2c, 0xc2, 0xf6,
+ 0xd7, 0xf1, 0xf5, 0x4f, 0xd3, 0x68, 0x86, 0x9b, 0x40, 0x47, 0x74, 0x51,
+ 0x2a, 0xe3, 0x87, 0xe3, 0x6f, 0x8c, 0x2e, 0x71, 0xb9, 0xe1, 0x49, 0x62,
+ 0x8b, 0x1f, 0x00, 0x92, 0x51, 0x82, 0x5b, 0x56, 0xeb, 0x55, 0x4e, 0x17,
+ 0x67, 0x91, 0x74, 0xc3, 0x01, 0xdc, 0x34, 0xda, 0x56, 0x03, 0x3c, 0x5d,
+ 0x50, 0xb5, 0xa5, 0xf5, 0xd0, 0xe1, 0x84, 0x7f, 0x2c, 0x16, 0x86, 0x34,
+ 0x1d, 0xb1, 0x8f, 0xd9, 0xb4, 0x0b, 0x35, 0x79
+};
+static const uint8_t ac_rsassa_vect1_prime1[] = {
+ 0xec, 0xbb, 0x19, 0x15, 0xc6, 0x52, 0xee, 0xf2, 0x75, 0x0b, 0x2f, 0x4f,
+ 0x1b, 0x2e, 0xd5, 0x14, 0x13, 0x26, 0xb4, 0xb4, 0x8d, 0x1d, 0xbd, 0x27,
+ 0xbb, 0x38, 0xba, 0x2f, 0xa7, 0xc7, 0xb6, 0x76, 0x88, 0xad, 0x73, 0x24,
+ 0x56, 0xe4, 0xd6, 0x9e, 0xe1, 0x20, 0x50, 0x4e, 0x90, 0x09, 0xb1, 0xf7,
+ 0x58, 0x1f, 0x47, 0x82, 0x88, 0xe7, 0xd8, 0xab, 0x3c, 0x1c, 0x9d, 0xc1,
+ 0xa7, 0x79, 0x5c, 0x65
+};
+static const uint8_t ac_rsassa_vect1_prime2[] = {
+ 0xb9, 0x32, 0xce, 0x2d, 0x38, 0xb4, 0x21, 0x7f, 0x9e, 0x79, 0x36, 0xf8,
+ 0x6a, 0xf4, 0x99, 0xae, 0x57, 0x1b, 0xd6, 0x1c, 0x53, 0xf7, 0xf9, 0x61,
+ 0xed, 0x47, 0xca, 0x7d, 0x76, 0xd7, 0x4e, 0xc6, 0x59, 0x51, 0x2d, 0xea,
+ 0x91, 0x0f, 0xdf, 0x56, 0x77, 0xa9, 0x2e, 0xf7, 0x63, 0x57, 0x14, 0x93,
+ 0x3b, 0x6f, 0x39, 0x4d, 0x88, 0x18, 0x2f, 0x78, 0xfc, 0xa3, 0xdb, 0xf6,
+ 0xc0, 0x05, 0xdd, 0x73
+};
+static const uint8_t ac_rsassa_vect1_exp1[] = {
+ 0xaa, 0xa7, 0x45, 0xb2, 0x18, 0xc1, 0xf8, 0x56, 0xf8, 0x61, 0x13, 0xbd,
+ 0xa7, 0x0e, 0xdf, 0xb4, 0x15, 0x0a, 0x36, 0x02, 0x62, 0x28, 0x2a, 0x0f,
+ 0xd6, 0x3b, 0x52, 0x9c, 0xc0, 0x0a, 0x8c, 0x52, 0x6e, 0xbc, 0xfa, 0xe0,
+ 0x1b, 0x73, 0xe3, 0xf3, 0xac, 0xbe, 0xaa, 0xa5, 0xb7, 0xd8, 0x05, 0x5f,
+ 0x15, 0x3b, 0x97, 0x45, 0x56, 0x84, 0x2c, 0x01, 0x64, 0xd8, 0x0c, 0x31,
+ 0x6a, 0x15, 0x66, 0xb1
+};
+static const uint8_t ac_rsassa_vect1_exp2[] = {
+ 0x82, 0xec, 0x11, 0xa9, 0x12, 0x5e, 0xf5, 0x17, 0x7c, 0xf6, 0x80, 0x0f,
+ 0xd9, 0xbc, 0x95, 0x30, 0x14, 0x50, 0x8f, 0x6a, 0x73, 0x49, 0xe8, 0x38,
+ 0x7c, 0x3f, 0xb6, 0x3c, 0x3f, 0xd9, 0x31, 0xcd, 0x32, 0xb3, 0x1a, 0xdc,
+ 0xaa, 0x34, 0x28, 0x54, 0xbe, 0x3f, 0x11, 0xfe, 0xbd, 0x71, 0x80, 0x10,
+ 0x1d, 0x82, 0x21, 0x66, 0x58, 0x01, 0x90, 0xfd, 0xdc, 0xcc, 0x11, 0xe2,
+ 0x3c, 0x19, 0x69, 0x55
+};
+static const uint8_t ac_rsassa_vect1_coeff[] = {
+ 0x2b, 0x9b, 0x48, 0xc0, 0xe1, 0xcb, 0x28, 0x9c, 0x03, 0xb2, 0xcf, 0xc6,
+ 0xf6, 0xbb, 0xbe, 0x1b, 0xad, 0xe6, 0x3b, 0xd3, 0x65, 0xbb, 0xca, 0xb7,
+ 0x43, 0x17, 0x8e, 0x3d, 0xb1, 0x6d, 0xc3, 0x06, 0xad, 0x7d, 0xe8, 0x81,
+ 0xb9, 0x5a, 0x13, 0xad, 0x18, 0x46, 0xcd, 0x93, 0xb6, 0x44, 0x1f, 0xd0,
+ 0x4d, 0x73, 0xb1, 0x00, 0x4d, 0x46, 0xc8, 0x22, 0x4a, 0x7e, 0xb8, 0xe6,
+ 0xdd, 0xae, 0x5f, 0x40
+};
+static const uint8_t ac_rsassa_vect1_ptx[] = {
+ 0x91, 0x07, 0xf4, 0x49, 0x0a, 0xf9, 0x99, 0x12, 0xaa, 0x95, 0x02, 0x76,
+ 0x95, 0x1b, 0xfa, 0x94, 0x32, 0xbf
+};
+static const uint8_t ac_rsassa_vect1_out[] = {
+ 0x5f, 0xf8, 0xc0, 0x00, 0x4b, 0xd6, 0x5a, 0x3b, 0xf9, 0x34, 0xad, 0xca,
+ 0x24, 0x8f, 0x8f, 0x99, 0xba, 0x24, 0xb3, 0x84, 0x1b, 0x82, 0xff, 0xdb,
+ 0x35, 0x00, 0xa0, 0x66, 0x62, 0xc3, 0x85, 0x4d, 0xfc, 0x4b, 0x42, 0xce,
+ 0xd1, 0x29, 0x39, 0x04, 0x16, 0xcb, 0xa2, 0x53, 0x12, 0x5d, 0x71, 0x5c,
+ 0xcd, 0x37, 0xcb, 0x0a, 0x5d, 0x07, 0xdd, 0xb2, 0x18, 0x94, 0x47, 0x2a,
+ 0x82, 0x64, 0x7a, 0xd3, 0xbb, 0x83, 0xc5, 0x9c, 0x50, 0x85, 0x65, 0x94,
+ 0x0f, 0x01, 0xfe, 0x20, 0xa0, 0x83, 0x4f, 0x3b, 0x78, 0x99, 0x48, 0x94,
+ 0x36, 0xaf, 0x4a, 0xac, 0x89, 0xfa, 0xf6, 0xf8, 0x42, 0x86, 0xa5, 0xbe,
+ 0x0d, 0xb3, 0x39, 0x42, 0xa0, 0x70, 0x56, 0x5f, 0xea, 0xc6, 0x8f, 0x31,
+ 0xfe, 0x56, 0x56, 0xac, 0xf7, 0x4c, 0x9b, 0x8a, 0x06, 0x5a, 0xbd, 0x61,
+ 0x92, 0xfc, 0xef, 0x4b, 0x26, 0x36, 0x6d, 0x91
+};
+
+
+/*
+ * Test data generated with
+ * http://www.mobilefish.com/services/rsa_key_generation/rsa_key_generation.php
+ * selecting 2048 bit key
+ */
+static const uint8_t ac_rsassa_vect2_modulus[] = {
+ 0x9a, 0x83, 0xda, 0x0e, 0xfb, 0xa1, 0x77, 0xc5, 0x34, 0x88, 0xac, 0x3d,
+ 0xd1, 0x3e, 0x89, 0x3e, 0xca, 0xad, 0x40, 0x47, 0xdc, 0xff, 0xc6, 0x18,
+ 0xc3, 0x1a, 0x95, 0xd3, 0x82, 0xb9, 0x98, 0xa8, 0xec, 0x90, 0xbe, 0xab,
+ 0xef, 0x74, 0xb7, 0x58, 0xa0, 0x0d, 0x0f, 0xb5, 0x13, 0xb8, 0x7e, 0xf7,
+ 0xdb, 0x19, 0x77, 0x55, 0xc5, 0xed, 0xa6, 0x60, 0xa7, 0xaf, 0xea, 0x83,
+ 0x69, 0xcf, 0xcf, 0x50, 0x51, 0x94, 0xa7, 0xc0, 0x96, 0x68, 0xe6, 0x63,
+ 0xef, 0xdf, 0xa8, 0x28, 0x4a, 0x50, 0xbf, 0xd7, 0x44, 0xbf, 0x0b, 0x0a,
+ 0x41, 0xd6, 0x02, 0xfc, 0x3f, 0x06, 0x51, 0x82, 0xe4, 0x56, 0x3f, 0xe9,
+ 0x37, 0x40, 0xe0, 0xaa, 0x18, 0x56, 0xcb, 0x2e, 0xd4, 0x02, 0x66, 0xcc,
+ 0xfb, 0xbd, 0x6b, 0x34, 0xfd, 0x3d, 0x2c, 0xad, 0xeb, 0x8c, 0x7c, 0x85,
+ 0x09, 0xd1, 0x00, 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,
+ 0x14, 0x4b, 0xee, 0xd6, 0xad, 0x27, 0x04, 0x99
+};
+static const uint8_t ac_rsassa_vect2_prime2[] = {
+ 0xc0, 0x05, 0x4f, 0x58, 0xa0, 0x22, 0x58, 0x60, 0x7b, 0xef, 0x87, 0x1f,
+ 0x87, 0x39, 0x47, 0x48, 0xa8, 0x86, 0x15, 0xd5, 0xf9, 0xb5, 0xf8, 0x71,
+ 0x81, 0xf9, 0xb7, 0x3e, 0x4a, 0xe8, 0x5d, 0xbc, 0xbf, 0x8f, 0x17, 0xc0,
+ 0x96, 0xdc, 0xc2, 0x7f, 0x5e, 0x60, 0x65, 0xe7, 0xa2, 0xc6, 0x30, 0x25,
+ 0x8b, 0xe9, 0xdb, 0x28, 0x10, 0xac, 0x02, 0x0e, 0x23, 0x0f, 0x14, 0x6b,
+ 0xff, 0xd4, 0x09, 0xdd, 0x7c, 0x06, 0x5d, 0xb2, 0x6e, 0x32, 0x49, 0x62,
+ 0xb7, 0x93, 0x5d, 0x24, 0x99, 0x03, 0x69, 0x9b, 0x60, 0x2e, 0x34, 0xa3,
+ 0x9f, 0x62, 0x33, 0xaf, 0xc5, 0xdc, 0x8f, 0x10, 0x61, 0xfa, 0xc5, 0x8d,
+ 0xa9, 0xcc, 0x86, 0x93, 0x7d, 0x1e, 0xa6, 0x7d, 0xcb, 0x6e, 0x69, 0xfe,
+ 0xe1, 0x3c, 0x64, 0x01, 0x58, 0xd8, 0x1a, 0x0f, 0xf8, 0xcc, 0x34, 0xe5,
+ 0x01, 0x2c, 0xb8, 0xf9, 0x90, 0x71, 0xe5, 0x35
+};
+static const uint8_t ac_rsassa_vect2_exp1[] = {
+ 0x8b, 0x46, 0xc7, 0x8f, 0xe9, 0xb0, 0x78, 0x9d, 0xb9, 0x64, 0x99, 0xdf,
+ 0xbd, 0xe2, 0x4f, 0x18, 0x2c, 0x78, 0xc5, 0x38, 0xa6, 0xa8, 0xae, 0x37,
+ 0x1c, 0x0c, 0x6c, 0x52, 0x20,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
+ 0xae, 0x4b, 0x84, 0x02, 0x92, 0x0c, 0x05, 0x42
+};
+static const uint8_t ac_rsassa_vect2_ptx[] = {
+ 0x91, 0x07, 0xf4, 0x49, 0x0a, 0xf9, 0x99, 0x12, 0xaa, 0x95, 0x02, 0x76,
+ 0x95, 0x1b, 0xfa, 0x94, 0x32, 0xbf
+};
+static const uint8_t ac_rsassa_vect2_out[] = {
+ 0x47, 0x16, 0xe1, 0xee, 0x54, 0xb7, 0xe0, 0x8a, 0xcc, 0x5d, 0x1b, 0xae,
+ 0xde, 0xc1, 0x43, 0x09, 0xd8, 0x4d, 0xe3, 0xcd, 0x5f, 0xd5, 0x48, 0x51,
+ 0xd3, 0x1c, 0x62, 0x5d, 0x1c, 0x13, 0x0b, 0x05, 0x89, 0x77, 0xd6, 0x95,
+ 0x4e, 0x8f, 0x4a, 0x0a, 0x51, 0xc2, 0x0c, 0xcf, 0xfe, 0x4c, 0x24, 0x6d,
+ 0x0c, 0x73, 0x33, 0x46, 0xd9, 0xdf, 0xfe, 0x6e, 0x06, 0xcb, 0x8c, 0x79,
+ 0x32, 0x3f, 0xbd, 0x1d, 0x10, 0x3a, 0x60, 0x3c, 0xe8, 0x1c, 0xbe, 0xd9,
+ 0xa8, 0x00, 0x76, 0x5b, 0x6d, 0x7a, 0x62, 0xdd, 0x3c, 0x21, 0x53, 0x16,
+ 0xab, 0x0b, 0x6c, 0x8d, 0x43, 0xfd, 0xba, 0x9a, 0xd9, 0x9a, 0xc1, 0x21,
+ 0x0c, 0x79, 0x78, 0x93, 0x86, 0xbd, 0xdf, 0x63, 0xca, 0xc8, 0xd6, 0xc6,
+ 0x20, 0xc9, 0x08, 0xf6, 0xc8, 0xfe, 0x22, 0xa4, 0xc6, 0xe3, 0x49, 0xe4,
+ 0x63, 0x01, 0x03, 0x5b, 0x78, 0x63, 0x3a, 0x02, 0x9c, 0xa1, 0xed, 0x20,
+ 0x01, 0x10, 0x79, 0x2e, 0x8d, 0xe5, 0x70, 0xae, 0x1a, 0x5f, 0x72, 0x9e,
+ 0x31, 0xab, 0x21, 0xd3, 0xd7, 0x59, 0x5f, 0x26, 0xbf, 0x45, 0x31, 0x6d,
+ 0xc3, 0xa6, 0x45, 0x7b, 0x6d, 0x8e, 0x3c, 0xb0, 0x42, 0xb4, 0xeb, 0x09,
+ 0xcf, 0x54, 0x0a, 0x72, 0x38, 0xf8, 0x67, 0x83, 0xa7, 0x7b, 0xce, 0x52,
+ 0x74, 0x0f, 0x03, 0x9d, 0x09, 0x1f, 0xe7, 0xf0, 0x85, 0x27, 0x3e, 0x1d,
+ 0x2f, 0xea, 0x2d, 0xa8, 0xdc, 0x58, 0x00, 0x9b, 0xdc, 0x10, 0x95, 0xe4,
+ 0x5f, 0x69, 0x20, 0x11, 0x1c, 0x3c, 0x58, 0x27, 0xcd, 0x1f, 0x23, 0xc9,
+ 0x28, 0xfa, 0x98, 0x53, 0xce, 0xa6, 0xe6, 0x64, 0x20, 0x2e, 0xe1, 0x2b,
+ 0x35, 0x30, 0x4e, 0xb2, 0x14, 0xaa, 0x7f, 0x89, 0x6f, 0xa8, 0xb1, 0xd6,
+ 0x30, 0x2c, 0x7c, 0xe5, 0x26, 0xe4, 0xce, 0x61, 0x6c, 0xc6, 0x06, 0xbc,
+ 0xea, 0x26, 0x6f, 0xe4
+};
+
+/*
+ * Test data from ftp://ftp.rsa.com/pub/rsalabs/tmp/pkcs1v15sign-vectors.txt
+ *
+ * As specified in PKCS#1, the block type for this operation
+ * is 1. The digest algorithm is SHA-1; i.e. the given message
+ * must be hashed and the SHA-1 hash must be encapsulated in a
+ * DigestInfo structure as specified in PKCS#1 v1.5.
+ */
+
+/* PKCS#1 v1.5 Signature Example 1 1024-bit RSA key pair */
+static const uint8_t ac_rsassa_example1_modulus[] = {
+ 0xa5, 0x6e, 0x4a, 0x0e, 0x70, 0x10, 0x17, 0x58, 0x9a, 0x51, 0x87, 0xdc,
+ 0x7e, 0xa8, 0x41, 0xd1,
+ 0x56, 0xf2, 0xec, 0x0e, 0x36, 0xad, 0x52, 0xa4, 0x4d, 0xfe, 0xb1, 0xe6,
+ 0x1f, 0x7a, 0xd9, 0x91,
+ 0xd8, 0xc5, 0x10, 0x56, 0xff, 0xed, 0xb1, 0x62, 0xb4, 0xc0, 0xf2, 0x83,
+ 0xa1, 0x2a, 0x88, 0xa3,
+ 0x94, 0xdf, 0xf5, 0x26, 0xab, 0x72, 0x91, 0xcb, 0xb3, 0x07, 0xce, 0xab,
+ 0xfc, 0xe0, 0xb1, 0xdf,
+ 0xd5, 0xcd, 0x95, 0x08, 0x09, 0x6d, 0x5b, 0x2b, 0x8b, 0x6d, 0xf5, 0xd6,
+ 0x71, 0xef, 0x63, 0x77,
+ 0xc0, 0x92, 0x1c, 0xb2, 0x3c, 0x27, 0x0a, 0x70, 0xe2, 0x59, 0x8e, 0x6f,
+ 0xf8, 0x9d, 0x19, 0xf1,
+ 0x05, 0xac, 0xc2, 0xd3, 0xf0, 0xcb, 0x35, 0xf2, 0x92, 0x80, 0xe1, 0x38,
+ 0x6b, 0x6f, 0x64, 0xc4,
+ 0xef, 0x22, 0xe1, 0xe1, 0xf2, 0x0d, 0x0c, 0xe8, 0xcf, 0xfb, 0x22, 0x49,
+ 0xbd, 0x9a, 0x21, 0x37,
+};
+static const uint8_t ac_rsassa_example1_pub_exp[] = {
+ 0x01, 0x00, 0x01
+};
+static const uint8_t ac_rsassa_example1_priv_exp[] = {
+ 0x33, 0xa5, 0x04, 0x2a, 0x90, 0xb2, 0x7d, 0x4f, 0x54, 0x51, 0xca, 0x9b,
+ 0xbb, 0xd0, 0xb4, 0x47,
+ 0x71, 0xa1, 0x01, 0xaf, 0x88, 0x43, 0x40, 0xae, 0xf9, 0x88, 0x5f, 0x2a,
+ 0x4b, 0xbe, 0x92, 0xe8,
+ 0x94, 0xa7, 0x24, 0xac, 0x3c, 0x56, 0x8c, 0x8f, 0x97, 0x85, 0x3a, 0xd0,
+ 0x7c, 0x02, 0x66, 0xc8,
+ 0xc6, 0xa3, 0xca, 0x09, 0x29, 0xf1, 0xe8, 0xf1, 0x12, 0x31, 0x88, 0x44,
+ 0x29, 0xfc, 0x4d, 0x9a,
+ 0xe5, 0x5f, 0xee, 0x89, 0x6a, 0x10, 0xce, 0x70, 0x7c, 0x3e, 0xd7, 0xe7,
+ 0x34, 0xe4, 0x47, 0x27,
+ 0xa3, 0x95, 0x74, 0x50, 0x1a, 0x53, 0x26, 0x83, 0x10, 0x9c, 0x2a, 0xba,
+ 0xca, 0xba, 0x28, 0x3c,
+ 0x31, 0xb4, 0xbd, 0x2f, 0x53, 0xc3, 0xee, 0x37, 0xe3, 0x52, 0xce, 0xe3,
+ 0x4f, 0x9e, 0x50, 0x3b,
+ 0xd8, 0x0c, 0x06, 0x22, 0xad, 0x79, 0xc6, 0xdc, 0xee, 0x88, 0x35, 0x47,
+ 0xc6, 0xa3, 0xb3, 0x25,
+};
+static const uint8_t ac_rsassa_example1_prime1[] = {
+ 0xe7, 0xe8, 0x94, 0x27, 0x20, 0xa8, 0x77, 0x51, 0x72, 0x73, 0xa3, 0x56,
+ 0x05, 0x3e, 0xa2, 0xa1,
+ 0xbc, 0x0c, 0x94, 0xaa, 0x72, 0xd5, 0x5c, 0x6e, 0x86, 0x29, 0x6b, 0x2d,
+ 0xfc, 0x96, 0x79, 0x48,
+ 0xc0, 0xa7, 0x2c, 0xbc, 0xcc, 0xa7, 0xea, 0xcb, 0x35, 0x70, 0x6e, 0x09,
+ 0xa1, 0xdf, 0x55, 0xa1,
+ 0x53, 0x5b, 0xd9, 0xb3, 0xcc, 0x34, 0x16, 0x0b, 0x3b, 0x6d, 0xcd, 0x3e,
+ 0xda, 0x8e, 0x64, 0x43,
+};
+static const uint8_t ac_rsassa_example1_prime2[] = {
+ 0xb6, 0x9d, 0xca, 0x1c, 0xf7, 0xd4, 0xd7, 0xec, 0x81, 0xe7, 0x5b, 0x90,
+ 0xfc, 0xca, 0x87, 0x4a,
+ 0xbc, 0xde, 0x12, 0x3f, 0xd2, 0x70, 0x01, 0x80, 0xaa, 0x90, 0x47, 0x9b,
+ 0x6e, 0x48, 0xde, 0x8d,
+ 0x67, 0xed, 0x24, 0xf9, 0xf1, 0x9d, 0x85, 0xba, 0x27, 0x58, 0x74, 0xf5,
+ 0x42, 0xcd, 0x20, 0xdc,
+ 0x72, 0x3e, 0x69, 0x63, 0x36, 0x4a, 0x1f, 0x94, 0x25, 0x45, 0x2b, 0x26,
+ 0x9a, 0x67, 0x99, 0xfd,
+};
+static const uint8_t ac_rsassa_example1_exp1[] = {
+ 0x28, 0xfa, 0x13, 0x93, 0x86, 0x55, 0xbe, 0x1f, 0x8a, 0x15, 0x9c, 0xba,
+ 0xca, 0x5a, 0x72, 0xea,
+ 0x19, 0x0c, 0x30, 0x08, 0x9e, 0x19, 0xcd, 0x27, 0x4a, 0x55, 0x6f, 0x36,
+ 0xc4, 0xf6, 0xe1, 0x9f,
+ 0x55, 0x4b, 0x34, 0xc0, 0x77, 0x79, 0x04, 0x27, 0xbb, 0xdd, 0x8d, 0xd3,
+ 0xed, 0xe2, 0x44, 0x83,
+ 0x28, 0xf3, 0x85, 0xd8, 0x1b, 0x30, 0xe8, 0xe4, 0x3b, 0x2f, 0xff, 0xa0,
+ 0x27, 0x86, 0x19, 0x79,
+};
+static const uint8_t ac_rsassa_example1_exp2[] = {
+ 0x1a, 0x8b, 0x38, 0xf3, 0x98, 0xfa, 0x71, 0x20, 0x49, 0x89, 0x8d, 0x7f,
+ 0xb7, 0x9e, 0xe0, 0xa7,
+ 0x76, 0x68, 0x79, 0x12, 0x99, 0xcd, 0xfa, 0x09, 0xef, 0xc0, 0xe5, 0x07,
+ 0xac, 0xb2, 0x1e, 0xd7,
+ 0x43, 0x01, 0xef, 0x5b, 0xfd, 0x48, 0xbe, 0x45, 0x5e, 0xae, 0xb6, 0xe1,
+ 0x67, 0x82, 0x55, 0x82,
+ 0x75, 0x80, 0xa8, 0xe4, 0xe8, 0xe1, 0x41, 0x51, 0xd1, 0x51, 0x0a, 0x82,
+ 0xa3, 0xf2, 0xe7, 0x29,
+};
+static const uint8_t ac_rsassa_example1_coeff[] = {
+ 0x27, 0x15, 0x6a, 0xba, 0x41, 0x26, 0xd2, 0x4a, 0x81, 0xf3, 0xa5, 0x28,
+ 0xcb, 0xfb, 0x27, 0xf5,
+ 0x68, 0x86, 0xf8, 0x40, 0xa9, 0xf6, 0xe8, 0x6e, 0x17, 0xa4, 0x4b, 0x94,
+ 0xfe, 0x93, 0x19, 0x58,
+ 0x4b, 0x8e, 0x22, 0xfd, 0xde, 0x1e, 0x5a, 0x2e, 0x3b, 0xd8, 0xaa, 0x5b,
+ 0xa8, 0xd8, 0x58, 0x41,
+ 0x94, 0xeb, 0x21, 0x90, 0xac, 0xf8, 0x32, 0xb8, 0x47, 0xf1, 0x3a, 0x3d,
+ 0x24, 0xa7, 0x9f, 0x4d,
+};
+
+/* PKCS#1 v1.5 Signature Example 1.1 */
+#define ac_rsassa_vect3_modulus ac_rsassa_example1_modulus
+#define ac_rsassa_vect3_pub_exp ac_rsassa_example1_pub_exp
+#define ac_rsassa_vect3_priv_exp ac_rsassa_example1_priv_exp
+#define ac_rsassa_vect3_prime1 ac_rsassa_example1_prime1
+#define ac_rsassa_vect3_prime2 ac_rsassa_example1_prime2
+#define ac_rsassa_vect3_exp1 ac_rsassa_example1_exp1
+#define ac_rsassa_vect3_exp2 ac_rsassa_example1_exp2
+#define ac_rsassa_vect3_coeff ac_rsassa_example1_coeff
+static const uint8_t ac_rsassa_vect3_ptx[] = {
+ 0xcd, 0xc8, 0x7d, 0xa2, 0x23, 0xd7, 0x86, 0xdf, 0x3b, 0x45, 0xe0, 0xbb,
+ 0xbc, 0x72, 0x13, 0x26,
+ 0xd1, 0xee, 0x2a, 0xf8, 0x06, 0xcc, 0x31, 0x54, 0x75, 0xcc, 0x6f, 0x0d,
+ 0x9c, 0x66, 0xe1, 0xb6,
+ 0x23, 0x71, 0xd4, 0x5c, 0xe2, 0x39, 0x2e, 0x1a, 0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75, 0x0a, 0x01, 0x67, 0xd0,
+};
+static const uint8_t ac_rsassa_vect3_out[] = {
+ 0x6b, 0xc3, 0xa0, 0x66, 0x56, 0x84, 0x29, 0x30, 0xa2, 0x47, 0xe3, 0x0d,
+ 0x58, 0x64, 0xb4, 0xd8,
+ 0x19, 0x23, 0x6b, 0xa7, 0xc6, 0x89, 0x65, 0x86, 0x2a, 0xd7, 0xdb, 0xc4,
+ 0xe2, 0x4a, 0xf2, 0x8e,
+ 0x86, 0xbb, 0x53, 0x1f, 0x03, 0x35, 0x8b, 0xe5, 0xfb, 0x74, 0x77, 0x7c,
+ 0x60, 0x86, 0xf8, 0x50,
+ 0xca, 0xef, 0x89, 0x3f, 0x0d, 0x6f, 0xcc, 0x2d, 0x0c, 0x91, 0xec, 0x01,
+ 0x36, 0x93, 0xb4, 0xea,
+ 0x00, 0xb8, 0x0c, 0xd4, 0x9a, 0xac, 0x4e, 0xcb, 0x5f, 0x89, 0x11, 0xaf,
+ 0xe5, 0x39, 0xad, 0xa4,
+ 0xa8, 0xf3, 0x82, 0x3d, 0x1d, 0x13, 0xe4, 0x72, 0xd1, 0x49, 0x05, 0x47,
+ 0xc6, 0x59, 0xc7, 0x61,
+ 0x7f, 0x3d, 0x24, 0x08, 0x7d, 0xdb, 0x6f, 0x2b, 0x72, 0x09, 0x61, 0x67,
+ 0xfc, 0x09, 0x7c, 0xab,
+ 0x18, 0xe9, 0xa4, 0x58, 0xfc, 0xb6, 0x34, 0xcd, 0xce, 0x8e, 0xe3, 0x58,
+ 0x94, 0xc4, 0x84, 0xd7,
+};
+
+/* PKCS#1 v1.5 Signature Example 1.2 */
+#define ac_rsassa_vect4_modulus ac_rsassa_example1_modulus
+#define ac_rsassa_vect4_pub_exp ac_rsassa_example1_pub_exp
+#define ac_rsassa_vect4_priv_exp ac_rsassa_example1_priv_exp
+#define ac_rsassa_vect4_prime1 ac_rsassa_example1_prime1
+#define ac_rsassa_vect4_prime2 ac_rsassa_example1_prime2
+#define ac_rsassa_vect4_exp1 ac_rsassa_example1_exp1
+#define ac_rsassa_vect4_exp2 ac_rsassa_example1_exp2
+#define ac_rsassa_vect4_coeff ac_rsassa_example1_coeff
+static const uint8_t ac_rsassa_vect4_ptx[] = {
+ 0x85, 0x13, 0x84, 0xcd, 0xfe, 0x81, 0x9c, 0x22, 0xed, 0x6c, 0x4c, 0xcb,
+ 0x30, 0xda, 0xeb, 0x5c,
+ 0xf0, 0x59, 0xbc, 0x8e, 0x11, 0x66, 0xb7, 0xe3, 0x53, 0x0c, 0x4c, 0x23,
+ 0x3e, 0x2b, 0x5f, 0x8f,
+ 0x71, 0xa1, 0xcc, 0xa5, 0x82, 0xd4, 0x3e, 0xcc, 0x72, 0xb1, 0xbc, 0xa1,
+ 0x6d, 0xfc, 0x70, 0x13,
+ 0x22, 0x6b, 0x9e,
+};
+static const uint8_t ac_rsassa_vect4_out[] = {
+ 0x84, 0xfd, 0x2c, 0xe7, 0x34, 0xec, 0x1d, 0xa8, 0x28, 0xd0, 0xf1, 0x5b,
+ 0xf4, 0x9a, 0x87, 0x07,
+ 0xc1, 0x5d, 0x05, 0x94, 0x81, 0x36, 0xde, 0x53, 0x7a, 0x3d, 0xb4, 0x21,
+ 0x38, 0x41, 0x67, 0xc8,
+ 0x6f, 0xae, 0x02, 0x25, 0x87, 0xee, 0x9e, 0x13, 0x7d, 0xae, 0xe7, 0x54,
+ 0x73, 0x82, 0x62, 0x93,
+ 0x2d, 0x27, 0x1c, 0x74, 0x4c, 0x6d, 0x3a, 0x18, 0x9a, 0xd4, 0x31, 0x1b,
+ 0xdb, 0x02, 0x04, 0x92,
+ 0xe3, 0x22, 0xfb, 0xdd, 0xc4, 0x04, 0x06, 0xea, 0x86, 0x0d, 0x4e, 0x8e,
+ 0xa2, 0xa4, 0x08, 0x4a,
+ 0xa9, 0x8b, 0x96, 0x22, 0xa4, 0x46, 0x75, 0x6f, 0xdb, 0x74, 0x0d, 0xdb,
+ 0x3d, 0x91, 0xdb, 0x76,
+ 0x70, 0xe2, 0x11, 0x66, 0x1b, 0xbf, 0x87, 0x09, 0xb1, 0x1c, 0x08, 0xa7,
+ 0x07, 0x71, 0x42, 0x2d,
+ 0x1a, 0x12, 0xde, 0xf2, 0x9f, 0x06, 0x88, 0xa1, 0x92, 0xae, 0xbd, 0x89,
+ 0xe0, 0xf8, 0x96, 0xf8,
+};
+
+/* PKCS#1 v1.5 Signature Example 1.3 */
+#define ac_rsassa_vect5_modulus ac_rsassa_example1_modulus
+#define ac_rsassa_vect5_pub_exp ac_rsassa_example1_pub_exp
+#define ac_rsassa_vect5_priv_exp ac_rsassa_example1_priv_exp
+#define ac_rsassa_vect5_prime1 ac_rsassa_example1_prime1
+#define ac_rsassa_vect5_prime2 ac_rsassa_example1_prime2
+#define ac_rsassa_vect5_exp1 ac_rsassa_example1_exp1
+#define ac_rsassa_vect5_exp2 ac_rsassa_example1_exp2
+#define ac_rsassa_vect5_coeff ac_rsassa_example1_coeff
+static const uint8_t ac_rsassa_vect5_ptx[] = {
+ 0xa4, 0xb1, 0x59, 0x94, 0x17, 0x61, 0xc4, 0x0c, 0x6a, 0x82, 0xf2, 0xb8,
+ 0x0d, 0x1b, 0x94, 0xf5,
+ 0xaa, 0x26, 0x54, 0xfd, 0x17, 0xe1, 0x2d, 0x58, 0x88, 0x64, 0x67, 0x9b,
+ 0x54, 0xcd, 0x04, 0xef,
+ 0x8b, 0xd0, 0x30, 0x12, 0xbe, 0x8d, 0xc3, 0x7f, 0x4b, 0x83, 0xaf, 0x79,
+ 0x63, 0xfa, 0xff, 0x0d,
+ 0xfa, 0x22, 0x54, 0x77, 0x43, 0x7c, 0x48, 0x01, 0x7f, 0xf2, 0xbe, 0x81,
+ 0x91, 0xcf, 0x39, 0x55,
+ 0xfc, 0x07, 0x35, 0x6e, 0xab, 0x3f, 0x32, 0x2f, 0x7f, 0x62, 0x0e, 0x21,
+ 0xd2, 0x54, 0xe5, 0xdb,
+ 0x43, 0x24, 0x27, 0x9f, 0xe0, 0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0xa9, 0x34, 0x25,
+ 0x2a, 0x3a, 0x24, 0x5f,
+ 0xf4, 0x83, 0x40, 0x92, 0x0e, 0x10, 0x34, 0xb7, 0xd5, 0xa5, 0xb5, 0x24,
+ 0xeb, 0x0e, 0x1c, 0xf1,
+ 0x2b, 0xef, 0xef, 0x49, 0xb2, 0x7b, 0x73, 0x2d, 0x2c, 0x19, 0xe1, 0xc4,
+ 0x32, 0x17, 0xd6, 0xe1,
+ 0x41, 0x73, 0x81, 0x11, 0x1a, 0x1d, 0x36, 0xde, 0x63, 0x75, 0xcf, 0x45,
+ 0x5b, 0x3c, 0x98, 0x12,
+ 0x63, 0x9d, 0xbc, 0x27, 0x60, 0x0c, 0x75, 0x19, 0x94, 0xfb, 0x61, 0x79,
+ 0x9e, 0xcf, 0x7d, 0xa6,
+ 0xbc, 0xf5, 0x15, 0x40, 0xaf, 0xd0, 0x17, 0x4d, 0xb4, 0x03, 0x31, 0x88,
+ 0x55, 0x66, 0x75, 0xb1,
+ 0xd7, 0x63, 0x36, 0x0a, 0xf4, 0x6f, 0xee, 0xca, 0x5b, 0x60, 0xf8, 0x82,
+ 0x82, 0x9e, 0xe7, 0xb2,
+};
+
+/* PKCS#1 v1.5 Signature Example 1.4 */
+#define ac_rsassa_vect6_modulus ac_rsassa_example1_modulus
+#define ac_rsassa_vect6_pub_exp ac_rsassa_example1_pub_exp
+#define ac_rsassa_vect6_priv_exp ac_rsassa_example1_priv_exp
+#define ac_rsassa_vect6_prime1 ac_rsassa_example1_prime1
+#define ac_rsassa_vect6_prime2 ac_rsassa_example1_prime2
+#define ac_rsassa_vect6_exp1 ac_rsassa_example1_exp1
+#define ac_rsassa_vect6_exp2 ac_rsassa_example1_exp2
+#define ac_rsassa_vect6_coeff ac_rsassa_example1_coeff
+static const uint8_t ac_rsassa_vect6_ptx[] = {
+ 0xbc, 0x65, 0x67, 0x47, 0xfa, 0x9e, 0xaf, 0xb3, 0xf0
+};
+static const uint8_t ac_rsassa_vect6_out[] = {
+ 0x45, 0x60, 0x7a, 0xd6, 0x11, 0xcf, 0x57, 0x47, 0xa4, 0x1a, 0xc9, 0x4d,
+ 0x0f, 0xfe, 0xc8, 0x78,
+ 0xbd, 0xaf, 0x63, 0xf6, 0xb5, 0x7a, 0x4b, 0x08, 0x8b, 0xf3, 0x6e, 0x34,
+ 0xe1, 0x09, 0xf8, 0x40,
+ 0xf2, 0x4b, 0x74, 0x2a, 0xda, 0x16, 0x10, 0x2d, 0xab, 0xf9, 0x51, 0xcb,
+ 0xc4, 0x4f, 0x89, 0x82,
+ 0xe9, 0x4e, 0xd4, 0xcd, 0x09, 0x44, 0x8d, 0x20, 0xec, 0x0e, 0xfa, 0x73,
+ 0x54, 0x5f, 0x80, 0xb6,
+ 0x54, 0x06, 0xbe, 0xd6, 0x19, 0x4a, 0x61, 0xc3, 0x40, 0xb4, 0xad, 0x15,
+ 0x68, 0xcb, 0xb7, 0x58,
+ 0x51, 0x04, 0x9f, 0x11, 0xaf, 0x17, 0x34, 0x96, 0x40, 0x76, 0xe0, 0x20,
+ 0x29, 0xae, 0xe2, 0x00,
+ 0xe4, 0x0e, 0x80, 0xbe, 0x0f, 0x43, 0x61, 0xf6, 0x98, 0x41, 0xc4, 0xf9,
+ 0x2a, 0x44, 0x50, 0xa2,
+ 0x28, 0x6d, 0x43, 0x28, 0x9b, 0x40, 0x55, 0x54, 0xc5, 0x4d, 0x25, 0xc6,
+ 0xec, 0xb5, 0x84, 0xf4,
+};
+
+/* PKCS#1 v1.5 Signature Example 7 1025-bit RSA key pair */
+static const uint8_t ac_rsassa_example2_modulus[] = {
+ 0x01, 0x69, 0x34, 0xcd, 0xff, 0x48, 0x50, 0xb6, 0x00, 0x2c, 0xc0, 0xf0,
+ 0xf4, 0x01, 0x0a, 0x32,
+ 0xc6, 0x55, 0xe5, 0xcf, 0x6e, 0x7c, 0x89, 0x93, 0x7f, 0xd7, 0x55, 0xef,
+ 0x6a, 0xbe, 0x37, 0x9d,
+ 0xad, 0xde, 0x70, 0xcc, 0x21, 0x77, 0x51, 0xf1, 0x4c, 0xba, 0x6d, 0x90,
+ 0xfe, 0x52, 0xdc, 0x0a,
+ 0xf5, 0x8b, 0x25, 0x2f, 0x26, 0xbf, 0x72, 0xda, 0x57, 0x9f, 0xda, 0xf5,
+ 0x7d, 0xdd, 0x6c, 0xd6,
+ 0x02, 0x18, 0x79, 0x94, 0x9a, 0x02, 0x76, 0xb4, 0x43, 0x3f, 0xf0, 0x1e,
+ 0xfc, 0xcc, 0xf3, 0x5a,
+ 0x11, 0xe7, 0xc7, 0x7b, 0x38, 0xc1, 0x8c, 0xca, 0x94, 0xae, 0x01, 0x2d,
+ 0x0f, 0x37, 0x04, 0x21,
+ 0x49, 0x1c, 0x52, 0xad, 0x15, 0xac, 0x76, 0xb1, 0x2e, 0xcd, 0x21, 0x8f,
+ 0x52, 0xe7, 0x57, 0x86,
+ 0x6e, 0x08, 0x9d, 0xd8, 0xad, 0xbb, 0x48, 0xe9, 0xba, 0x89, 0x43, 0x36,
+ 0xc5, 0x75, 0xc4, 0x06,
+ 0x55
+};
+static const uint8_t ac_rsassa_example2_pub_exp[] = {
+ 0x01, 0x00, 0x01
+};
+static const uint8_t ac_rsassa_example2_priv_exp[] = {
+ 0x0d, 0x17, 0x19, 0xe5, 0xbd, 0x47, 0x6d, 0x87, 0xc7, 0xec, 0xc3, 0x1e,
+ 0xb8, 0xab, 0x42, 0x5d,
+ 0x4f, 0xe4, 0xc8, 0xf5, 0xc7, 0xae, 0x23, 0x0a, 0x10, 0x47, 0x55, 0x3f,
+ 0xfb, 0x53, 0x9f, 0xd3,
+ 0x85, 0x5a, 0xf5, 0xa4, 0x3b, 0x2d, 0xdd, 0x4e, 0x95, 0xa2, 0xb3, 0x0d,
+ 0x40, 0x7a, 0xa8, 0x81,
+ 0x59, 0xbb, 0xad, 0x2a, 0x87, 0x3d, 0x80, 0x93, 0xb4, 0x8a, 0x4b, 0xce,
+ 0x20, 0xad, 0x99, 0x26,
+ 0x25, 0x3e, 0xd3, 0x39, 0xac, 0x3b, 0x54, 0x3f, 0xc7, 0x42, 0x96, 0x95,
+ 0x33, 0x8d, 0xb0, 0xbc,
+ 0x1d, 0xc3, 0x68, 0x6c, 0xfd, 0x13, 0x9b, 0xb5, 0xb2, 0x87, 0x36, 0xbc,
+ 0x16, 0x60, 0xa9, 0x53,
+ 0x48, 0xfc, 0x91, 0xc3, 0x25, 0xd0, 0x3a, 0x7f, 0xb2, 0x16, 0xd2, 0xd9,
+ 0xcd, 0x93, 0x64, 0xde,
+ 0x4e, 0xe7, 0xd2, 0x11, 0x9c, 0x3b, 0x0f, 0xbb, 0xa8, 0xa7, 0x1f, 0x0d,
+ 0x3f, 0x5a, 0xb9, 0xb9,
+};
+static const uint8_t ac_rsassa_example2_prime1[] = {
+ 0x01, 0x58, 0xc0, 0x24, 0x6c, 0xd1, 0x69, 0xfc, 0x59, 0x3b, 0x25, 0x8b,
+ 0xbf, 0x45, 0x23, 0xab,
+ 0x2b, 0x55, 0xc4, 0x60, 0x73, 0x3a, 0x7f, 0xb4, 0x69, 0x10, 0x90, 0x77,
+ 0xb3, 0x0e, 0x4d, 0x35,
+ 0xf2, 0x1a, 0x35, 0xb1, 0xf4, 0x1e, 0x42, 0x04, 0xe8, 0x1d, 0x2e, 0x4c,
+ 0x46, 0x3c, 0x24, 0x11,
+ 0x39, 0x34, 0x09, 0x8b, 0x45, 0x2d, 0xab, 0x4b, 0xe1, 0x59, 0x97, 0x20,
+ 0xef, 0x68, 0x72, 0x83,
+ 0x3d
+};
+static const uint8_t ac_rsassa_example2_prime2[] = {
+ 0x01, 0x0c, 0x38, 0x2d, 0xea, 0x5e, 0x7d, 0x79, 0x29, 0x8c, 0x64, 0x1f,
+ 0xb2, 0xe4, 0xfa, 0x09,
+ 0xf2, 0x4f, 0x6a, 0x7a, 0x45, 0x9a, 0x88, 0x2c, 0x87, 0xa8, 0x03, 0x49,
+ 0x5f, 0x05, 0x6e, 0xcc,
+ 0x3b, 0x43, 0xc5, 0x37, 0x73, 0x1f, 0x85, 0xef, 0xc8, 0xfb, 0x53, 0x87,
+ 0xad, 0x67, 0x31, 0xa6,
+ 0x43, 0x53, 0x32, 0x15, 0xde, 0xcc, 0x38, 0x7d, 0x96, 0x76, 0x12, 0x2c,
+ 0x17, 0x0e, 0x91, 0xe0,
+ 0xf9
+};
+static const uint8_t ac_rsassa_example2_exp1[] = {
+ 0xd5, 0x78, 0xdc, 0xd5, 0x38, 0xf2, 0xfc, 0xdc, 0x30, 0x00, 0xb6, 0xc0,
+ 0xf0, 0x49, 0xfe, 0xe2,
+ 0xad, 0x90, 0x14, 0xfd, 0x24, 0xfb, 0x10, 0xb6, 0x82, 0x18, 0x42, 0xd6,
+ 0x70, 0x03, 0xa5, 0x64,
+ 0xcd, 0x8f, 0xf4, 0x2a, 0x2a, 0x56, 0x4c, 0xfd, 0x81, 0x9c, 0x3a, 0x84,
+ 0xbf, 0x16, 0xc2, 0x47,
+ 0x7e, 0x8e, 0x6e, 0x5b, 0x9e, 0xc4, 0xd4, 0x0e, 0xad, 0x50, 0x24, 0x87,
+ 0xba, 0x50, 0x36, 0x2d,
+};
+static const uint8_t ac_rsassa_example2_exp2[] = {
+ 0x88, 0x88, 0xdc, 0x8e, 0xae, 0x94, 0xee, 0xa5, 0x80, 0xca, 0xc2, 0xfc,
+ 0x1c, 0xe5, 0x4f, 0x44,
+ 0xe2, 0xba, 0x50, 0x0d, 0xb8, 0x71, 0x53, 0x41, 0xa6, 0xfc, 0x2d, 0x50,
+ 0x4a, 0x82, 0xb1, 0x42,
+ 0x05, 0xe8, 0x91, 0xa6, 0x6f, 0xc8, 0x8d, 0x5c, 0x60, 0xdb, 0x8f, 0x78,
+ 0x6c, 0xcc, 0x70, 0x57,
+ 0x5b, 0x35, 0x66, 0xbe, 0xa8, 0x74, 0xa5, 0x31, 0x7f, 0x5f, 0x16, 0xc4,
+ 0x91, 0xed, 0x1e, 0x79,
+};
+static const uint8_t ac_rsassa_example2_coeff[] = {
+ 0x17, 0xb0, 0xd6, 0x23, 0x36, 0x19, 0x1e, 0x63, 0xbc, 0xa1, 0x59, 0x93,
+ 0x4d, 0x06, 0x16, 0xcb,
+ 0x89, 0x97, 0x40, 0x9c, 0xbf, 0xca, 0x37, 0x05, 0x69, 0x5b, 0x14, 0xfb,
+ 0x64, 0xa0, 0x81, 0xc1,
+ 0xc9, 0xf5, 0x86, 0x19, 0x3e, 0x52, 0x3a, 0xbd, 0x0b, 0xeb, 0x8d, 0x72,
+ 0x0c, 0xfe, 0x53, 0x7d,
+ 0xfa, 0x1e, 0xde, 0xc4, 0xa6, 0x64, 0x37, 0xd2, 0x41, 0x19, 0x6b, 0x7a,
+ 0x2c, 0xe5, 0x56, 0xc4,
+};
+
+
+/* PKCS#1 v1.5 Signature Example 7.1 */
+#define ac_rsassa_vect7_modulus ac_rsassa_example2_modulus
+#define ac_rsassa_vect7_pub_exp ac_rsassa_example2_pub_exp
+#define ac_rsassa_vect7_priv_exp ac_rsassa_example2_priv_exp
+#define ac_rsassa_vect7_prime1 ac_rsassa_example2_prime1
+#define ac_rsassa_vect7_prime2 ac_rsassa_example2_prime2
+#define ac_rsassa_vect7_exp1 ac_rsassa_example2_exp1
+#define ac_rsassa_vect7_exp2 ac_rsassa_example2_exp2
+#define ac_rsassa_vect7_coeff ac_rsassa_example2_coeff
+static const uint8_t ac_rsassa_vect7_ptx[] = {
+ 0x35, 0x39, 0x99, 0x7a, 0xe7, 0x09, 0xfe, 0x32, 0xc1, 0x03, 0x6a, 0x13,
+ 0x27, 0x57, 0xf2, 0xa1,
+ 0x66, 0x7a, 0x91, 0xcc, 0x83, 0xbe, 0x73, 0x3a, 0xad, 0xa1, 0xbd, 0xd2,
+ 0x17, 0x92, 0x4c, 0x9a,
+ 0x2c, 0x9f, 0xed, 0x1f, 0xec, 0xf6, 0x1d, 0x1c, 0xf7, 0x9d, 0xae, 0x9a,
+ 0x83, 0xf8, 0xae, 0x3f,
+ 0x4d, 0x05, 0x1b, 0x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5, 0x62, 0x4b,
+ 0x71, 0x8d, 0xc7, 0xc0, 0x86, 0x1e, 0x58, 0x6b, 0xa8, 0xb6, 0x0a, 0x29,
+ 0xd6, 0xa5, 0x75, 0x5c,
+ 0xd2, 0xcc, 0x50, 0x85, 0x99, 0xc6, 0xe2, 0x8d, 0x73, 0x55, 0xb2, 0x7e,
+ 0x40, 0xb7, 0x40, 0xc6,
+ 0xfb, 0xbb, 0xb1, 0xa9, 0x18, 0x23, 0xb1, 0xc1, 0x24, 0x2b, 0xa6, 0x93,
+ 0xd4, 0x52, 0x69, 0x51,
+ 0x47, 0xdb, 0xb2, 0x3e, 0xa8, 0x9c, 0xbf, 0x11, 0xeb, 0x8b, 0x07, 0xec,
+ 0x3a, 0x02, 0x7b, 0x0f,
+ 0x17
+};
+
+/*
+ * Test data from 186-2rsatestvectors.zip SigVet15_186-3.rsp with CRT
+ * parameters created with:
+ * http://sourceforge.net/projects/rsaconverter/
+ */
+
+/* SigGen15_186-2.txt line 9 mod 1024 */
+static const uint8_t ac_siggen15_186_2_modulus[] = {
+ 0xc8, 0xa2, 0x06, 0x91, 0x82, 0x39, 0x4a, 0x2a, 0xb7, 0xc3, 0xf4, 0x19,
+ 0x0c, 0x15, 0x58, 0x9c, 0x56, 0xa2, 0xd4, 0xbc, 0x42, 0xdc, 0xa6, 0x75,
+ 0xb3, 0x4c, 0xc9, 0x50, 0xe2, 0x46, 0x63, 0x04, 0x84, 0x41, 0xe8, 0xaa,
+ 0x59, 0x3b, 0x2b, 0xc5, 0x9e, 0x19, 0x8b, 0x8c, 0x25, 0x7e, 0x88, 0x21,
+ 0x20, 0xc6, 0x23, 0x36, 0xe5, 0xcc, 0x74, 0x50, 0x12, 0xc7, 0xff, 0xb0,
+ 0x63, 0xee, 0xbe, 0x53, 0xf3, 0xc6, 0x50, 0x4c, 0xba, 0x6c, 0xfe, 0x51,
+ 0xba, 0xa3, 0xb6, 0xd1, 0x07, 0x4b, 0x2f, 0x39, 0x81, 0x71, 0xf4, 0xb1,
+ 0x98, 0x2f, 0x4d, 0x65, 0xca, 0xf8, 0x82, 0xea, 0x4d, 0x56, 0xf3, 0x2a,
+ 0xb5, 0x7d, 0x0c, 0x44, 0xe6, 0xad, 0x4e, 0x9c, 0xf5, 0x7a, 0x43, 0x39,
+ 0xeb, 0x69, 0x62, 0x40, 0x6e, 0x35, 0x0c, 0x1b, 0x15, 0x39, 0x71, 0x83,
+ 0xfb, 0xf1, 0xf0, 0x35, 0x3c, 0x9f, 0xc9, 0x91
+};
+static const uint8_t ac_siggen15_186_2_pub_exp[] = {
+ 0x01, 0x00, 0x01
+};
+static const uint8_t ac_siggen15_186_2_priv_exp[] = {
+ 0x5d, 0xfc, 0xb1, 0x11, 0x07, 0x2d, 0x29, 0x56, 0x5b, 0xa1, 0xdb, 0x3e,
+ 0xc4, 0x8f, 0x57, 0x64, 0x5d, 0x9d, 0x88, 0x04, 0xed, 0x59, 0x8a, 0x4d,
+ 0x47, 0x02, 0x68, 0xa8, 0x90, 0x67, 0xa2, 0xc9, 0x21, 0xdf, 0xf2, 0x4b,
+ 0xa2, 0xe3, 0x7a, 0x3c, 0xe8, 0x34, 0x55, 0x50, 0x00, 0xdc, 0x86, 0x8e,
+ 0xe6, 0x58, 0x8b, 0x74, 0x93, 0x30, 0x35, 0x28, 0xb1, 0xb3, 0xa9, 0x4f,
+ 0x0b, 0x71, 0x73, 0x0c, 0xf1, 0xe8, 0x6f, 0xca, 0x5a, 0xee, 0xdc, 0x3a,
+ 0xfa, 0x16, 0xf6, 0x5c, 0x01, 0x89, 0xd8, 0x10, 0xdd, 0xcd, 0x81, 0x04,
+ 0x9e, 0xbb, 0xd0, 0x39, 0x18, 0x68, 0xc5, 0x0e, 0xde, 0xc9, 0x58, 0xb3,
+ 0xa2, 0xaa, 0xef, 0xf6, 0xa5, 0x75, 0x89, 0x7e, 0x2f, 0x20, 0xa3, 0xab,
+ 0x54, 0x55, 0xc1, 0xbf, 0xa5, 0x50, 0x10, 0xac, 0x51, 0xa7, 0x79, 0x9b,
+ 0x1f, 0xf8, 0x48, 0x36, 0x44, 0xa3, 0xd4, 0x25
+};
+static const uint8_t ac_siggen15_186_2_prime1[] = {
+ 0xF6, 0x6A, 0x24, 0x68, 0xB1, 0x48, 0x1A, 0x0D, 0x6B, 0x60, 0x49, 0x67,
+ 0xF0, 0x58, 0x03, 0x89, 0xD6, 0x06, 0x1F, 0x03, 0x3A, 0x9B, 0x57, 0xB7,
+ 0x4D, 0x1B, 0xEF, 0xE8, 0x10, 0x11, 0x98, 0x94, 0x5B, 0x80, 0x93, 0x04,
+ 0x24, 0x1D, 0x02, 0xFD, 0x5F, 0x92, 0x1F, 0xE9, 0x59, 0xFB, 0xEC, 0xDB,
+ 0x18, 0x00, 0x54, 0x86, 0x9A, 0xDB, 0x17, 0xD3, 0x21, 0xF9, 0xD5, 0xD5,
+ 0x98, 0x12, 0x3E, 0x73
+};
+static const uint8_t ac_siggen15_186_2_prime2[] = {
+ 0xD0, 0x6F, 0xFA, 0x56, 0x3B, 0xD0, 0xB8, 0xB9, 0x7F, 0x00, 0x72, 0xEA,
+ 0x07, 0x51, 0x03, 0xEC, 0x1F, 0xF0, 0xB1, 0x7F, 0xD6, 0xBD, 0xAF, 0x94,
+ 0xA7, 0x5A, 0xE6, 0x03, 0x59, 0x82, 0xF6, 0x80, 0x24, 0x9D, 0x77, 0xCC,
+ 0x15, 0x96, 0xA6, 0x54, 0xF1, 0x4C, 0x51, 0x7A, 0x13, 0xB9, 0x5F, 0x1A,
+ 0x8C, 0x5D, 0xE8, 0xCC, 0x84, 0xAD, 0x38, 0xD2, 0xE6, 0xAA, 0x4F, 0xCD,
+ 0x54, 0x1A, 0x32, 0xEB
+};
+static const uint8_t ac_siggen15_186_2_exp1[] = {
+ 0xD4, 0xD4, 0xB6, 0x9F, 0xCA, 0x47, 0x89, 0x60, 0xFF, 0xD6, 0x49, 0x70,
+ 0xC1, 0xD1, 0x73, 0x34, 0xF1, 0x2B, 0x96, 0x4B,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8B, 0xC6, 0x8B, 0xAF, 0x6C, 0xC9, 0x13,
+ 0xB2, 0xE6, 0x26, 0x72
+};
+
+/* SigGen15_186-2.txt line 13 SHA-1*/
+#define ac_rsassa_vect8_modulus ac_siggen15_186_2_modulus
+#define ac_rsassa_vect8_pub_exp ac_siggen15_186_2_pub_exp
+#define ac_rsassa_vect8_priv_exp ac_siggen15_186_2_priv_exp
+#define ac_rsassa_vect8_prime1 ac_siggen15_186_2_prime1
+#define ac_rsassa_vect8_prime2 ac_siggen15_186_2_prime2
+#define ac_rsassa_vect8_exp1 ac_siggen15_186_2_exp1
+#define ac_rsassa_vect8_exp2 ac_siggen15_186_2_exp2
+#define ac_rsassa_vect8_coeff ac_siggen15_186_2_coeff
+static const uint8_t ac_rsassa_vect8_ptx[] = {
+ 0xe8, 0x31, 0x27, 0x42, 0xae, 0x23, 0xc4, 0x56, 0xef, 0x28, 0xa2, 0x31,
+ 0x42, 0xc4, 0x49, 0x08, 0x95, 0x83, 0x27, 0x65, 0xda, 0xdc, 0xe0, 0x2a,
+ 0xfe, 0x5b, 0xe5, 0xd3, 0x1b, 0x00, 0x48, 0xfb, 0xee, 0xe2, 0xcf, 0x21,
+ 0x8b, 0x17, 0x47, 0xad, 0x4f, 0xd8, 0x1a, 0x2e, 0x17, 0xe1, 0x24, 0xe6,
+ 0xaf, 0x17, 0xc3, 0x88, 0x8e, 0x6d, 0x2d, 0x40, 0xc0, 0x08, 0x07, 0xf4,
+ 0x23, 0xa2, 0x33, 0xca, 0xd6, 0x2c, 0xe9, 0xea, 0xef, 0xb7, 0x09, 0x85,
+ 0x6c, 0x94, 0xaf, 0x16, 0x6d, 0xba, 0x08, 0xe7, 0xa0, 0x69, 0x65, 0xd7,
+ 0xfc, 0x0d, 0x8e, 0x5c, 0xb2, 0x65, 0x59, 0xc4, 0x60, 0xe4, 0x7b, 0xc0,
+ 0x88, 0x58, 0x9d, 0x22, 0x42, 0xc9, 0xb3, 0xe6, 0x2d, 0xa4, 0x89, 0x6f,
+ 0xab, 0x19, 0x9e, 0x14, 0x4e, 0xc1, 0x36, 0xdb, 0x8d, 0x84, 0xab, 0x84,
+ 0xbc, 0xba, 0x04, 0xca, 0x3b, 0x90, 0xc8, 0xe5
+};
+static const uint8_t ac_rsassa_vect8_out[] = {
+ 0x28, 0x92, 0x8e, 0x19, 0xeb, 0x86, 0xf9, 0xc0, 0x00, 0x70, 0xa5, 0x9e,
+ 0xdf, 0x6b, 0xf8, 0x43, 0x3a, 0x45, 0xdf, 0x49, 0x5c, 0xd1, 0xc7, 0x36,
+ 0x13, 0xc2, 0x12, 0x98, 0x40, 0xf4, 0x8c, 0x4a, 0x2c, 0x24, 0xf1, 0x1d,
+ 0xf7, 0x9b, 0xc5, 0xc0, 0x78, 0x2b, 0xce, 0xdd, 0xe9, 0x7d, 0xbb, 0xb2,
+ 0xac, 0xc6, 0xe5, 0x12, 0xd1, 0x9f, 0x08, 0x50, 0x27, 0xcd, 0x57, 0x50,
+ 0x38, 0x45, 0x3d, 0x04, 0x90, 0x54, 0x13, 0xe9, 0x47, 0xe6, 0xe1, 0xdd,
+ 0xdb, 0xeb, 0x35, 0x35, 0xcd, 0xb3, 0xd8, 0x97, 0x1f, 0xe0, 0x20, 0x05,
+ 0x06, 0x94, 0x10, 0x56, 0xf2, 0x12, 0x43, 0x50, 0x3c, 0x83, 0xea, 0xdd,
+ 0xe0, 0x53, 0xed, 0x86, 0x6c, 0x0e, 0x02, 0x50, 0xbe, 0xdd, 0xd9, 0x27,
+ 0xa0, 0x82, 0x12, 0xaa, 0x8a, 0xc0, 0xef, 0xd6, 0x16, 0x31, 0xef, 0x89,
+ 0xd8, 0xd0, 0x49, 0xef, 0xb3, 0x6b, 0xb3, 0x5f
+};
+
+/* SigGen15_186-2.txt line 54 SHA-224*/
+#define ac_rsassa_vect16_modulus ac_siggen15_186_2_modulus
+#define ac_rsassa_vect16_pub_exp ac_siggen15_186_2_pub_exp
+#define ac_rsassa_vect16_priv_exp ac_siggen15_186_2_priv_exp
+#define ac_rsassa_vect16_prime1 ac_siggen15_186_2_prime1
+#define ac_rsassa_vect16_prime2 ac_siggen15_186_2_prime2
+#define ac_rsassa_vect16_exp1 ac_siggen15_186_2_exp1
+#define ac_rsassa_vect16_exp2 ac_siggen15_186_2_exp2
+#define ac_rsassa_vect16_coeff ac_siggen15_186_2_coeff
+static const uint8_t ac_rsassa_vect16_ptx[] = {
+ 0xe5, 0x67, 0xa3, 0x9a, 0xe4, 0xe5, 0xef, 0x9b, 0x68, 0x01, 0xea, 0x05,
+ 0x61, 0xb7, 0x2a, 0x5d, 0x4b, 0x5f, 0x38, 0x5f, 0x05, 0x32, 0xfc, 0x9f,
+ 0xe1, 0x0a, 0x75, 0x70, 0xf8, 0x69, 0xae, 0x05, 0xc0, 0xbd, 0xed, 0xd6,
+ 0xe0, 0xe2, 0x2d, 0x45, 0x42, 0xe9, 0xce, 0x82, 0x6a, 0x18, 0x8c, 0xac,
+ 0x07, 0x31, 0xae, 0x39, 0xc8, 0xf8, 0x7f, 0x97, 0x71, 0xef, 0x02, 0x13,
+ 0x2e, 0x64, 0xe2, 0xfb, 0x27, 0xad, 0xa8, 0xff, 0x54, 0xb3, 0x30, 0xdd,
+ 0x93, 0xad, 0x5e, 0x3e, 0xf8, 0x2e, 0x0d, 0xda, 0x64, 0x62, 0x48, 0xe3,
+ 0x59, 0x94, 0xbd, 0xa1, 0x0c, 0xf4, 0x6e, 0x5a, 0xbc, 0x98, 0xaa, 0x74,
+ 0x43, 0xc0, 0x3c, 0xdd, 0xeb, 0x5e, 0xe2, 0xab, 0x82, 0xd6, 0x01, 0x00,
+ 0xb1, 0x02, 0x96, 0x31, 0x89, 0x79, 0x70, 0x27, 0x5f, 0x11, 0x9d, 0x05,
+ 0xda, 0xa2, 0x22, 0x0a, 0x4a, 0x0d, 0xef, 0xba
+};
+static const uint8_t ac_rsassa_vect16_out[] = {
+ 0x5a, 0xa5, 0x03, 0x33, 0x81, 0xbd, 0xd0, 0xac, 0xce, 0x33, 0x2d, 0xd3,
+ 0x14, 0xda, 0xf0, 0x08, 0xac, 0xaa, 0x9e, 0x83, 0x5f, 0x83, 0x29, 0x79,
+ 0x89, 0x1d, 0x1b, 0xda, 0x2b, 0x55, 0xd5, 0xea, 0xe3, 0x5c, 0x47, 0x9c,
+ 0x06, 0xca, 0xc5, 0xbf, 0x33, 0xf4, 0x32, 0xc8, 0xc0, 0xa5, 0x54, 0x9d,
+ 0x1d, 0x1b, 0x29, 0xc5, 0xe2, 0x58, 0x90, 0x24, 0xd2, 0x78, 0x00, 0xa0,
+ 0xc2, 0x35, 0xa6, 0x15, 0x32, 0xc2, 0x03, 0xcb, 0xc4, 0x06, 0xac, 0x6e,
+ 0xcf, 0x63, 0xf5, 0x2a, 0xe7, 0x71, 0xb9, 0x7c, 0x08, 0xe4, 0xb1, 0x08,
+ 0xec, 0x91, 0x69, 0x00, 0xe5, 0xa1, 0x1b, 0x1d, 0x48, 0xcc, 0xa8, 0x6c,
+ 0xa5, 0xa5, 0xa7, 0x99, 0xed, 0x32, 0xe9, 0x9c, 0x81, 0x5c, 0xef, 0x04,
+ 0xcf, 0x8e, 0xb5, 0x52, 0x23, 0xbf, 0xd4, 0xd9, 0xc3, 0x44, 0x92, 0x64,
+ 0xb6, 0x00, 0x61, 0xbc, 0x36, 0x84, 0xbc, 0x82
+};
+
+/* SigGen15_186-2.txt line 93 SHA-256 */
+#define ac_rsassa_vect9_modulus ac_siggen15_186_2_modulus
+#define ac_rsassa_vect9_pub_exp ac_siggen15_186_2_pub_exp
+#define ac_rsassa_vect9_priv_exp ac_siggen15_186_2_priv_exp
+#define ac_rsassa_vect9_prime1 ac_siggen15_186_2_prime1
+#define ac_rsassa_vect9_prime2 ac_siggen15_186_2_prime2
+#define ac_rsassa_vect9_exp1 ac_siggen15_186_2_exp1
+#define ac_rsassa_vect9_exp2 ac_siggen15_186_2_exp2
+#define ac_rsassa_vect9_coeff ac_siggen15_186_2_coeff
+static const uint8_t ac_rsassa_vect9_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, 0x40, 0x6d, 0xb6, 0x09, 0x36,
+ 0x9c, 0x88, 0xca, 0x99, 0xb3, 0x4f, 0xa1, 0x56, 0xc7, 0xee, 0x62, 0xbc,
+ 0x5a, 0x39, 0x23, 0xbb, 0x5a, 0x1e, 0xda, 0xbd, 0x45, 0xc1, 0xa4, 0x22,
+ 0xaa, 0xfc, 0xbb, 0x47, 0xe0, 0x94, 0x7f, 0x35, 0xcf, 0xef, 0x87, 0x97,
+ 0x0b, 0x4b, 0x71, 0x31, 0x62, 0xb2, 0x19, 0x16, 0xca, 0xfb, 0x8c, 0x86,
+ 0x4a, 0x3e, 0x5b, 0x9f, 0xfc, 0x98, 0x94, 0x01, 0xd4, 0xea, 0xe9, 0x92,
+ 0x31, 0x2a, 0x32, 0xc5, 0xbc, 0x88, 0xab, 0xbb, 0x45, 0xf9, 0x9a, 0xc8,
+ 0x85, 0xb5, 0x4d, 0x6b, 0x8e, 0x61, 0xb6, 0xec
+};
+
+/* SigGen15_186-2.txt line 133 SHA-384*/
+#define ac_rsassa_vect10_modulus ac_siggen15_186_2_modulus
+#define ac_rsassa_vect10_pub_exp ac_siggen15_186_2_pub_exp
+#define ac_rsassa_vect10_priv_exp ac_siggen15_186_2_priv_exp
+#define ac_rsassa_vect10_prime1 ac_siggen15_186_2_prime1
+#define ac_rsassa_vect10_prime2 ac_siggen15_186_2_prime2
+#define ac_rsassa_vect10_exp1 ac_siggen15_186_2_exp1
+#define ac_rsassa_vect10_exp2 ac_siggen15_186_2_exp2
+#define ac_rsassa_vect10_coeff ac_siggen15_186_2_coeff
+static const uint8_t ac_rsassa_vect10_ptx[] = {
+ 0xe5, 0x67, 0xa3, 0x9a, 0xe4, 0xe5, 0xef, 0x9b, 0x68, 0x01, 0xea, 0x05,
+ 0x61, 0xb7, 0x2a, 0x5d, 0x4b, 0x5f, 0x38, 0x5f, 0x05, 0x32, 0xfc, 0x9f,
+ 0xe1, 0x0a, 0x75, 0x70, 0xf8, 0x69, 0xae, 0x05, 0x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e, 0xb4, 0x3c, 0x56, 0x70, 0x6d, 0x83,
+ 0x31, 0x49, 0x53, 0x47, 0x06, 0x36, 0x44, 0x10, 0x86, 0x41, 0x9a, 0xb9,
+ 0xe6, 0xfd, 0x1e, 0xc4, 0xf9, 0xd5, 0xcc, 0x65, 0x44, 0x81, 0x5d, 0x1e,
+ 0x02, 0xed, 0x96, 0xa3, 0xae, 0x64, 0xc6, 0x99, 0x8b, 0x2c, 0xf2, 0x38,
+ 0xe7, 0x9a, 0x12, 0x16, 0x43, 0x52, 0xd1, 0x2a
+};
+
+/* SigGen15_186-2.txt line 173 SHA-512*/
+#define ac_rsassa_vect11_modulus ac_siggen15_186_2_modulus
+#define ac_rsassa_vect11_pub_exp ac_siggen15_186_2_pub_exp
+#define ac_rsassa_vect11_priv_exp ac_siggen15_186_2_priv_exp
+#define ac_rsassa_vect11_prime1 ac_siggen15_186_2_prime1
+#define ac_rsassa_vect11_prime2 ac_siggen15_186_2_prime2
+#define ac_rsassa_vect11_exp1 ac_siggen15_186_2_exp1
+#define ac_rsassa_vect11_exp2 ac_siggen15_186_2_exp2
+#define ac_rsassa_vect11_coeff ac_siggen15_186_2_coeff
+static const uint8_t ac_rsassa_vect11_ptx[] = {
+ 0xe5, 0x67, 0xa3, 0x9a, 0xe4, 0xe5, 0xef, 0x9b, 0x68, 0x01, 0xea, 0x05,
+ 0x61, 0xb7, 0x2a, 0x5d, 0x4b, 0x5f, 0x38, 0x5f, 0x05, 0x32, 0xfc, 0x9f,
+ 0xe1, 0x0a, 0x75, 0x70, 0xf8, 0x69, 0xae, 0x05, 0xc0, 0xbd, 0xed, 0xd6,
+ 0xe0, 0xe2, 0x2d, 0x45, 0x42, 0xe9, 0xce, 0x82, 0x6a, 0x18, 0x8c, 0xac,
+ 0x07, 0x31, 0xae, 0x39, 0xc8, 0xf8, 0x7f, 0x97, 0x71, 0xef, 0x02, 0x13,
+ 0x2e, 0x64, 0xe2, 0xfb, 0x27, 0xad, 0xa8, 0xff, 0x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60, 0xfe, 0x39, 0xc7, 0x9e, 0x68, 0x43, 0x47,
+ 0xef, 0x4d, 0x14, 0x4e, 0xa1, 0x8f, 0x7a, 0x4e
+};
+
+
+/* SigGenPSS_186-2.txt line 9 mod 1024 */
+static const uint8_t ac_siggenpss_186_2_modulus[] = {
+ 0xbc, 0xb4, 0x7b, 0x2e, 0x0d, 0xaf, 0xcb, 0xa8, 0x1f, 0xf2, 0xa2, 0xb5,
+ 0xcb, 0x11, 0x5c, 0xa7, 0xe7, 0x57, 0x18, 0x4c, 0x9d, 0x72, 0xbc, 0xdc,
+ 0xda, 0x70, 0x7a, 0x14, 0x6b, 0x3b, 0x4e, 0x29, 0x98, 0x9d, 0xdc, 0x66,
+ 0x0b, 0xd6, 0x94, 0x86, 0x5b, 0x93, 0x2b, 0x71, 0xca, 0x24, 0xa3, 0x35,
+ 0xcf, 0x4d, 0x33, 0x9c, 0x71, 0x91, 0x83, 0xe6, 0x22, 0x2e, 0x4c, 0x9e,
+ 0xa6, 0x87, 0x5a, 0xcd, 0x52, 0x8a, 0x49, 0xba, 0x21, 0x86, 0x3f, 0xe0,
+ 0x81, 0x47, 0xc3, 0xa4, 0x7e, 0x41, 0x99, 0x0b, 0x51, 0xa0, 0x3f, 0x77,
+ 0xd2, 0x21, 0x37, 0xf8, 0xd7, 0x4c, 0x43, 0xa5, 0xa4, 0x5f, 0x4e, 0x9e,
+ 0x18, 0xa2, 0xd1, 0x5d, 0xb0, 0x51, 0xdc, 0x89, 0x38, 0x5d, 0xb9, 0xcf,
+ 0x83, 0x74, 0xb6, 0x3a, 0x8c, 0xc8, 0x81, 0x13, 0x71, 0x0e, 0x6d, 0x81,
+ 0x79, 0x07, 0x5b, 0x7d, 0xc7, 0x9e, 0xe7, 0x6b
+};
+static const uint8_t ac_siggenpss_186_2_pub_exp[] = {
+ 0x01, 0x00, 0x01
+};
+static const uint8_t ac_siggenpss_186_2_priv_exp[] = {
+ 0x38, 0x3a, 0x6f, 0x19, 0xe1, 0xea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, 0x86, 0x18, 0x41, 0x8B, 0x51, 0xDB, 0x02, 0x69, 0x3F, 0xAB, 0xB4,
+ 0xE6, 0x83, 0x87, 0x25
+};
+static const uint8_t ac_siggenpss_186_2_prime2[] = {
+ 0xD2, 0xA4, 0xEC, 0x0F, 0xA2, 0x22, 0x6C, 0xDE, 0x82, 0xDA, 0x77, 0x65,
+ 0x3B, 0x07, 0x2C, 0xD0, 0x98, 0x53, 0x5D, 0x3E, 0x90, 0xED, 0x4D, 0x72,
+ 0x24, 0xDC, 0xB8, 0xCB, 0x8B, 0x93, 0x14, 0x76, 0x8D, 0xC5, 0x17, 0xE2,
+ 0x2D, 0x7C, 0x8F, 0xA1, 0x3F, 0x25, 0x3D, 0xAA, 0x74, 0x65, 0xA7, 0x99,
+ 0x56, 0x09, 0x8A, 0xA4, 0xCC, 0x3A, 0x6E, 0x35, 0xE8, 0xB1, 0xFC, 0xC4,
+ 0xF9, 0x7E, 0x77, 0x4F
+};
+static const uint8_t ac_siggenpss_186_2_exp1[] = {
+ 0x1F, 0x6A, 0xCA, 0xB9, 0x25, 0x85, 0x76, 0x41, 0xCF, 0x1B, 0x39, 0x85,
+ 0x40, 0x80, 0x9E, 0x34, 0xB5, 0x67, 0x0D, 0x87, 0xAC, 0x92, 0xA8, 0x1A,
+ 0x37, 0x88, 0xA5, 0x98, 0x04, 0x4A, 0x0C, 0x99, 0xA1, 0xD5, 0x61, 0x2B,
+ 0x7B, 0x2F, 0x0E, 0x3E, 0x33, 0x64, 0x7F, 0x4A, 0xF4, 0x1D, 0xCF, 0x81,
+ 0xFD, 0x22, 0x57, 0x9C, 0x53, 0x0B, 0xA9, 0xA7, 0x10, 0xE8, 0x0A, 0x0B,
+ 0xC4, 0x30, 0x6C, 0x89
+};
+static const uint8_t ac_siggenpss_186_2_exp2[] = {
+ 0x59, 0xF2, 0x84, 0xBE, 0xD4, 0x3C, 0x21, 0x03, 0x0F, 0x1B, 0x5C, 0xDA,
+ 0x84, 0x4F, 0x37, 0x0A, 0xC7, 0xD0, 0xE9, 0x43, 0x3B, 0x3D, 0xA9, 0xD1,
+ 0x70, 0xFE, 0x33, 0x86, 0xEF, 0x4D, 0xD9, 0xF2, 0x19, 0xED, 0xAC, 0x9A,
+ 0x2F, 0x54, 0x3E, 0x3C, 0xDB, 0xAA, 0xFA, 0x5F, 0x1C, 0x1F, 0x00, 0x67,
+ 0x50, 0xBE, 0xF8, 0x4E, 0x10, 0xCB, 0x6E, 0x9E, 0x64, 0x84, 0x04, 0x6C,
+ 0xD4, 0x20, 0xF5, 0xAF
+};
+static const uint8_t ac_siggenpss_186_2_coeff[] = {
+ 0x83, 0x5F, 0xC1, 0xB6, 0x52, 0x1C, 0x83, 0xE7, 0x6F, 0x80, 0x64, 0xFF,
+ 0xF8, 0x38, 0x80, 0xE1, 0xC9, 0x8F, 0x81, 0x13, 0x1E, 0xE8, 0x6E, 0x5D,
+ 0xF8, 0x57, 0x6A, 0xDA, 0x7D, 0x75, 0xC2, 0x6F, 0x8D, 0xB8, 0xBA, 0x8B,
+ 0x46, 0xF4, 0x6C, 0x69, 0xA5, 0x9D, 0xC5, 0xF2, 0x11, 0x8A, 0x9A, 0x90,
+ 0x8E, 0xC0, 0x8F, 0x45, 0xB0, 0x50, 0x4D, 0x2A, 0x42, 0x86, 0x49, 0x5E,
+ 0x2A, 0x1B, 0x78, 0x2E
+};
+/* Salt: 6f2841166a64471d4f0b8ed0dbb7db32161da13b */
+#define ac_siggenpss_186_2_salt_len 20
+
+
+/* SigGen15_186-2.txt line 173 SHA-1 */
+#define ac_rsassa_vect12_modulus ac_siggenpss_186_2_modulus
+#define ac_rsassa_vect12_pub_exp ac_siggenpss_186_2_pub_exp
+#define ac_rsassa_vect12_priv_exp ac_siggenpss_186_2_priv_exp
+#define ac_rsassa_vect12_prime1 ac_siggenpss_186_2_prime1
+#define ac_rsassa_vect12_prime2 ac_siggenpss_186_2_prime2
+#define ac_rsassa_vect12_exp1 ac_siggenpss_186_2_exp1
+#define ac_rsassa_vect12_exp2 ac_siggenpss_186_2_exp2
+#define ac_rsassa_vect12_coeff ac_siggenpss_186_2_coeff
+#define ac_rsassa_vect12_salt_len ac_siggenpss_186_2_salt_len
+static const uint8_t ac_rsassa_vect12_ptx[] = {
+ 0x12, 0x48, 0xf6, 0x2a, 0x43, 0x89, 0xf4, 0x2f, 0x7b, 0x4b, 0xb1, 0x31,
+ 0x05, 0x3d, 0x6c, 0x88, 0xa9, 0x94, 0xdb, 0x20, 0x75, 0xb9, 0x12, 0xcc,
+ 0xbe, 0x3e, 0xa7, 0xdc, 0x61, 0x17, 0x14, 0xf1, 0x4e, 0x07, 0x5c, 0x10,
+ 0x48, 0x58, 0xf2, 0xf6, 0xe6, 0xcf, 0xd6, 0xab, 0xde, 0xdf, 0x01, 0x5a,
+ 0x82, 0x1d, 0x03, 0x60, 0x8b, 0xf4, 0xeb, 0xa3, 0x16, 0x9a, 0x67, 0x25,
+ 0xec, 0x42, 0x2c, 0xd9, 0x06, 0x94, 0x98, 0xb5, 0x51, 0x5a, 0x96, 0x08,
+ 0xae, 0x7c, 0xc3, 0x0e, 0x3d, 0x2e, 0xcf, 0xc1, 0xdb, 0x68, 0x25, 0xf3,
+ 0xe9, 0x96, 0xce, 0x9a, 0x50, 0x92, 0x92, 0x6b, 0xc1, 0xcf, 0x61, 0xaa,
+ 0x42, 0xd7, 0xf2, 0x40, 0xe6, 0xf7, 0xaa, 0x0e, 0xdb, 0x38, 0xbf, 0x81,
+ 0xaa, 0x92, 0x9d, 0x66, 0xbb, 0x5d, 0x89, 0x00, 0x18, 0x08, 0x84, 0x58,
+ 0x72, 0x0d, 0x72, 0xd5, 0x69, 0x24, 0x7b, 0x0c
+};
+static const uint8_t ac_rsassa_vect12_out[] = {
+ 0x68, 0x2c, 0xf5, 0x3c, 0x11, 0x45, 0xd2, 0x2a, 0x50, 0xca, 0xa9, 0xeb,
+ 0x1a, 0x9b, 0xa7, 0x06, 0x70, 0xc5, 0x91, 0x5e, 0x0f, 0xdf, 0xde, 0x64,
+ 0x57, 0xa7, 0x65, 0xde, 0x2a, 0x8f, 0xe1, 0x2d, 0xe9, 0x79, 0x41, 0x72,
+ 0xa7, 0x8d, 0x14, 0xe6, 0x68, 0xd4, 0x98, 0xac, 0xed, 0xad, 0x61, 0x65,
+ 0x04, 0xbb, 0x17, 0x64, 0xd0, 0x94, 0x60, 0x70, 0x70, 0x08, 0x05, 0x92,
+ 0xc3, 0xa6, 0x9c, 0x34, 0x3d, 0x98, 0x2b, 0xd7, 0x78, 0x65, 0x87, 0x3d,
+ 0x35, 0xe2, 0x48, 0x22, 0xca, 0xf4, 0x34, 0x43, 0xcc, 0x10, 0x24, 0x9a,
+ 0xf6, 0xa1, 0xe2, 0x6e, 0xf3, 0x44, 0xf2, 0x8b, 0x9e, 0xf6, 0xf1, 0x4e,
+ 0x09, 0xad, 0x83, 0x97, 0x48, 0xe5, 0x14, 0x8b, 0xcc, 0xeb, 0x0f, 0xd2,
+ 0xaa, 0x63, 0x70, 0x9c, 0xb4, 0x89, 0x75, 0xcb, 0xf9, 0xc7, 0xb4, 0x9a,
+ 0xbc, 0x66, 0xa1, 0xdc, 0x6c, 0xb5, 0xb3, 0x1a
+};
+
+/* SigGenPSS_186-2.txt line 66 SHA-224 */
+#define ac_rsassa_vect17_modulus ac_siggenpss_186_2_modulus
+#define ac_rsassa_vect17_pub_exp ac_siggenpss_186_2_pub_exp
+#define ac_rsassa_vect17_priv_exp ac_siggenpss_186_2_priv_exp
+#define ac_rsassa_vect17_prime1 ac_siggenpss_186_2_prime1
+#define ac_rsassa_vect17_prime2 ac_siggenpss_186_2_prime2
+#define ac_rsassa_vect17_exp1 ac_siggenpss_186_2_exp1
+#define ac_rsassa_vect17_exp2 ac_siggenpss_186_2_exp2
+#define ac_rsassa_vect17_coeff ac_siggenpss_186_2_coeff
+#define ac_rsassa_vect17_salt_len ac_siggenpss_186_2_salt_len
+static const uint8_t ac_rsassa_vect17_ptx[] = {
+ 0x12, 0x48, 0xf6, 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0x91,
+ 0xf2, 0x38, 0x5b, 0xbc, 0xf1, 0x0d, 0x9e, 0x92, 0xbc, 0xf5, 0xd0, 0xe2,
+ 0x96, 0x0d, 0x10, 0xe7, 0x92, 0xe7, 0xd8, 0x65, 0xc6, 0x4e, 0x50, 0xd1,
+ 0x9f, 0xfa, 0x13, 0xe5, 0x28, 0x17, 0xd7, 0xd8, 0xd8, 0xdb, 0x34, 0x39,
+ 0x2c, 0x23, 0x74, 0xa2, 0xe9, 0xb6, 0x91, 0x84, 0xf9, 0x2a, 0x4a, 0xd9,
+ 0xb1, 0xb8, 0xba, 0xe9, 0x9c, 0xa6, 0x14, 0xd2, 0x04, 0xb6, 0x5a, 0x43,
+ 0x8e, 0x38, 0xdb, 0xbf, 0xc8, 0xc7, 0xcc, 0x44, 0xed, 0x56, 0x77, 0xaf,
+ 0x70, 0xce, 0x6c, 0x4f, 0x95, 0x1f, 0x02, 0x44,
+};
+
+/* SigGen15_186-2.txt line 114 SHA-256 */
+#define ac_rsassa_vect13_modulus ac_siggenpss_186_2_modulus
+#define ac_rsassa_vect13_pub_exp ac_siggenpss_186_2_pub_exp
+#define ac_rsassa_vect13_priv_exp ac_siggenpss_186_2_priv_exp
+#define ac_rsassa_vect13_prime1 ac_siggenpss_186_2_prime1
+#define ac_rsassa_vect13_prime2 ac_siggenpss_186_2_prime2
+#define ac_rsassa_vect13_exp1 ac_siggenpss_186_2_exp1
+#define ac_rsassa_vect13_exp2 ac_siggenpss_186_2_exp2
+#define ac_rsassa_vect13_coeff ac_siggenpss_186_2_coeff
+#define ac_rsassa_vect13_salt_len ac_siggenpss_186_2_salt_len
+static const uint8_t ac_rsassa_vect13_ptx[] = {
+ 0x12, 0x48, 0xf6, 0x2a, 0x43, 0x89, 0xf4, 0x2f, 0x7b, 0x4b, 0xb1, 0x31,
+ 0x05, 0x3d, 0x6c, 0x88, 0xa9, 0x94, 0xdb, 0x20, 0x75, 0xb9, 0x12, 0xcc,
+ 0xbe, 0x3e, 0xa7,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4,
+ 0x4a, 0x00, 0x7a, 0xbf, 0x4d, 0xd8, 0x2c, 0x26, 0xe8, 0xb0, 0x03, 0x93,
+ 0x72, 0x3a, 0xea, 0x15, 0xab, 0xfb, 0xc2, 0x29, 0x41, 0xc8, 0xcf, 0x79,
+ 0x48, 0x17, 0x18, 0xc0, 0x08, 0xda, 0x71, 0x3f, 0xb8, 0xf5, 0x4c, 0xb3,
+ 0xfc, 0xa8, 0x90, 0xbd, 0xe1, 0x13, 0x73, 0x14, 0x33, 0x4b, 0x9b, 0x0a,
+ 0x18, 0x51, 0x5b, 0xfa, 0x48, 0xe5, 0xcc, 0xd0
+};
+
+/* SigGen15_186-2.txt line 164 SHA-384 */
+#define ac_rsassa_vect14_modulus ac_siggenpss_186_2_modulus
+#define ac_rsassa_vect14_pub_exp ac_siggenpss_186_2_pub_exp
+#define ac_rsassa_vect14_priv_exp ac_siggenpss_186_2_priv_exp
+#define ac_rsassa_vect14_prime1 ac_siggenpss_186_2_prime1
+#define ac_rsassa_vect14_prime2 ac_siggenpss_186_2_prime2
+#define ac_rsassa_vect14_exp1 ac_siggenpss_186_2_exp1
+#define ac_rsassa_vect14_exp2 ac_siggenpss_186_2_exp2
+#define ac_rsassa_vect14_coeff ac_siggenpss_186_2_coeff
+#define ac_rsassa_vect14_salt_len ac_siggenpss_186_2_salt_len
+static const uint8_t ac_rsassa_vect14_ptx[] = {
+ 0x12, 0x48, 0xf6, 0x2a, 0x43, 0x89, 0xf4, 0x2f, 0x7b, 0x4b, 0xb1, 0x31,
+ 0x05, 0x3d, 0x6c, 0x88, 0xa9, 0x94, 0xdb, 0x20, 0x75, 0xb9, 0x12, 0xcc,
+ 0xbe, 0x3e, 0xa7, 0xdc, 0x61, 0x17, 0x14, 0xf1, 0x4e, 0x07, 0x5c, 0x10,
+ 0x48, 0x58, 0xf2, 0xf6, 0xe6, 0xcf, 0xd6, 0xab, 0xde, 0xdf, 0x01, 0x5a,
+ 0x82, 0x1d, 0x03, 0x60, 0x8b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 0x50, 0xe2, 0xa1, 0xdc, 0xf5, 0xa1, 0x61, 0xce, 0xab, 0xba, 0x2b, 0x0b,
+ 0x66, 0xc7, 0x35, 0x4f, 0xdb, 0x80, 0xfa, 0x1d, 0x72, 0x9e, 0x5f, 0x97,
+ 0x63, 0x87, 0xf2, 0x4a, 0x69, 0x7a, 0x7e, 0x56
+};
+
+/* SigGen15_186-2.txt line 214 SHA-512 */
+#define ac_rsassa_vect15_modulus ac_siggenpss_186_2_modulus
+#define ac_rsassa_vect15_pub_exp ac_siggenpss_186_2_pub_exp
+#define ac_rsassa_vect15_priv_exp ac_siggenpss_186_2_priv_exp
+#define ac_rsassa_vect15_prime1 ac_siggenpss_186_2_prime1
+#define ac_rsassa_vect15_prime2 ac_siggenpss_186_2_prime2
+#define ac_rsassa_vect15_exp1 ac_siggenpss_186_2_exp1
+#define ac_rsassa_vect15_exp2 ac_siggenpss_186_2_exp2
+#define ac_rsassa_vect15_coeff ac_siggenpss_186_2_coeff
+#define ac_rsassa_vect15_salt_len ac_siggenpss_186_2_salt_len
+static const uint8_t ac_rsassa_vect15_ptx[] = {
+ 0x12, 0x48, 0xf6, 0x2a, 0x43, 0x89, 0xf4, 0x2f, 0x7b, 0x4b, 0xb1, 0x31,
+ 0x05, 0x3d, 0x6c, 0x88, 0xa9, 0x94, 0xdb, 0x20, 0x75, 0xb9, 0x12, 0xcc,
+ 0xbe, 0x3e, 0xa7, 0xdc, 0x61, 0x17, 0x14, 0xf1, 0x4e, 0x07, 0x5c, 0x10,
+ 0x48, 0x58, 0xf2, 0xf6, 0xe6, 0xcf, 0xd6, 0xab, 0xde, 0xdf, 0x01, 0x5a,
+ 0x82, 0x1d, 0x03, 0x60, 0x8b, 0xf4, 0xeb, 0xa3, 0x16, 0x9a, 0x67, 0x25,
+ 0xec, 0x42, 0x2c, 0xd9, 0x06, 0x94, 0x98, 0xb5, 0x51, 0x5a, 0x96, 0x08,
+ 0xae, 0x7c, 0xc3, 0x0e, 0x3d, 0x2e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e4, 0x01, 0x62, 0x19, 0x8c, 0xc5, 0xcb, 0xd1
+};
+
+/*
+ * Test data from 186-3dsatestvectors.zip SigGen.txt
+ */
+
+/* SigGen.txt line 12 SHA-1 */
+static const uint8_t ac_dsa_vect1_prime[] = {
+ 0xa8, 0xf9, 0xcd, 0x20, 0x1e, 0x5e, 0x35, 0xd8, 0x92, 0xf8, 0x5f, 0x80,
+ 0xe4, 0xdb, 0x25, 0x99, 0xa5, 0x67, 0x6a, 0x3b, 0x1d, 0x4f, 0x19, 0x03,
+ 0x30, 0xed, 0x32, 0x56, 0xb2, 0x6d, 0x0e, 0x80, 0xa0, 0xe4, 0x9a, 0x8f,
+ 0xff, 0xaa, 0xad, 0x2a, 0x24, 0xf4, 0x72, 0xd2, 0x57, 0x32, 0x41, 0xd4,
+ 0xd6, 0xd6, 0xc7, 0x48, 0x0c, 0x80, 0xb4, 0xc6, 0x7b, 0xb4, 0x47, 0x9c,
+ 0x15, 0xad, 0xa7, 0xea, 0x84, 0x24, 0xd2, 0x50, 0x2f, 0xa0, 0x14, 0x72,
+ 0xe7, 0x60, 0x24, 0x17, 0x13, 0xda, 0xb0, 0x25, 0xae, 0x1b, 0x02, 0xe1,
+ 0x70, 0x3a, 0x14, 0x35, 0xf6, 0x2d, 0xdf, 0x4e, 0xe4, 0xc1, 0xb6, 0x64,
+ 0x06, 0x6e, 0xb2, 0x2f, 0x2e, 0x3b, 0xf2, 0x8b, 0xb7, 0x0a, 0x2a, 0x76,
+ 0xe4, 0xfd, 0x5e, 0xbe, 0x2d, 0x12, 0x29, 0x68, 0x1b, 0x5b, 0x06, 0x43,
+ 0x9a, 0xc9, 0xc7, 0xe9, 0xd8, 0xbd, 0xe2, 0x83
+};
+static const uint8_t ac_dsa_vect1_sub_prime[] = {
+ 0xf8, 0x5f, 0x0f, 0x83, 0xac, 0x4d, 0xf7, 0xea, 0x0c, 0xdf, 0x8f, 0x46,
+ 0x9b, 0xfe, 0xea, 0xea, 0x14, 0x15, 0x64, 0x95
+};
+static const uint8_t ac_dsa_vect1_base[] = {
+ 0x2b, 0x31, 0x52, 0xff, 0x6c, 0x62, 0xf1, 0x46, 0x22, 0xb8, 0xf4, 0x8e,
+ 0x59, 0xf8, 0xaf, 0x46, 0x88, 0x3b, 0x38, 0xe7, 0x9b, 0x8c, 0x74, 0xde,
+ 0xea, 0xe9, 0xdf, 0x13, 0x1f, 0x8b, 0x85, 0x6e, 0x3a, 0xd6, 0xc8, 0x45,
+ 0x5d, 0xab, 0x87, 0xcc, 0x0d, 0xa8, 0xac, 0x97, 0x34, 0x17, 0xce, 0x4f,
+ 0x78, 0x78, 0x55, 0x7d, 0x6c, 0xdf, 0x40, 0xb3, 0x5b, 0x4a, 0x0c, 0xa3,
+ 0xeb, 0x31, 0x0c, 0x6a, 0x95, 0xd6, 0x8c, 0xe2, 0x84, 0xad, 0x4e, 0x25,
+ 0xea, 0x28, 0x59, 0x16, 0x11, 0xee, 0x08, 0xb8, 0x44, 0x4b, 0xd6, 0x4b,
+ 0x25, 0xf3, 0xf7, 0xc5, 0x72, 0x41, 0x0d, 0xdf, 0xb3, 0x9c, 0xc7, 0x28,
+ 0xb9, 0xc9, 0x36, 0xf8, 0x5f, 0x41, 0x91, 0x29, 0x86, 0x99, 0x29, 0xcd,
+ 0xb9, 0x09, 0xa6, 0xa3, 0xa9, 0x9b, 0xbe, 0x08, 0x92, 0x16, 0x36, 0x81,
+ 0x71, 0xbd, 0x0b, 0xa8, 0x1d, 0xe4, 0xfe, 0x33
+};
+static const uint8_t ac_dsa_vect1_pub_val[] = {
+ 0x31, 0x3f, 0xd9, 0xeb, 0xca, 0x91, 0x57, 0x4e, 0x1c, 0x2e, 0xeb, 0xe1,
+ 0x51, 0x7c, 0x57, 0xe0, 0xc2, 0x1b, 0x02, 0x09, 0x87, 0x21, 0x40, 0xc5,
+ 0x32, 0x87, 0x61, 0xbb, 0xb2, 0x45, 0x0b, 0x33, 0xf1, 0xb1, 0x8b, 0x40,
+ 0x9c, 0xe9, 0xab, 0x7c, 0x4c, 0xd8, 0xfd, 0xa3, 0x39, 0x1e, 0x8e, 0x34,
+ 0x86, 0x83, 0x57, 0xc1, 0x99, 0xe1, 0x6a, 0x6b, 0x2e, 0xba, 0x06, 0xd6,
+ 0x74, 0x9d, 0xef, 0x79, 0x1d, 0x79, 0xe9, 0x5d, 0x3a, 0x4d, 0x09, 0xb2,
+ 0x4c, 0x39, 0x2a, 0xd8, 0x9d, 0xbf, 0x10, 0x09, 0x95, 0xae, 0x19, 0xc0,
+ 0x10, 0x62, 0x05, 0x6b, 0xb1, 0x4b, 0xce, 0x00, 0x5e, 0x87, 0x31, 0xef,
+ 0xde, 0x17, 0x5f, 0x95, 0xb9, 0x75, 0x08, 0x9b, 0xdc, 0xda, 0xea, 0x56,
+ 0x2b, 0x32, 0x78, 0x6d, 0x96, 0xf5, 0xa3, 0x1a, 0xed, 0xf7, 0x53, 0x64,
+ 0x00, 0x8a, 0xd4, 0xff, 0xfe, 0xbb, 0x97, 0x0b
+};
+static const uint8_t ac_dsa_vect1_priv_val[] = {
+ 0xc5, 0x3e, 0xae, 0x6d, 0x45, 0x32, 0x31, 0x64, 0xc7, 0xd0, 0x7a, 0xf5,
+ 0x71, 0x57, 0x03, 0x74, 0x4a, 0x63, 0xfc, 0x3a
+};
+/* K = 98cbcc4969d845e2461b5f66383dd503712bbcfa */
+static const uint8_t ac_dsa_vect1_ptx[] = {
+ 0x3b, 0x46, 0x73, 0x6d, 0x55, 0x9b, 0xd4, 0xe0, 0xc2, 0xc1, 0xb2, 0x55,
+ 0x3a, 0x33, 0xad, 0x3c, 0x6c, 0xf2, 0x3c, 0xac, 0x99, 0x8d, 0x3d, 0x0c,
+ 0x0e, 0x8f, 0xa4, 0xb1, 0x9b, 0xca, 0x06, 0xf2, 0xf3, 0x86, 0xdb, 0x2d,
+ 0xcf, 0xf9, 0xdc, 0xa4, 0xf4, 0x0a, 0xd8, 0xf5, 0x61, 0xff, 0xc3, 0x08,
+ 0xb4, 0x6c, 0x5f, 0x31, 0xa7, 0x73, 0x5b, 0x5f, 0xa7, 0xe0, 0xf9, 0xe6,
+ 0xcb, 0x51, 0x2e, 0x63, 0xd7, 0xee, 0xa0, 0x55, 0x38, 0xd6, 0x6a, 0x75,
+ 0xcd, 0x0d, 0x42, 0x34, 0xb5, 0xcc, 0xf6, 0xc1, 0x71, 0x5c, 0xca, 0xaf,
+ 0x9c, 0xdc, 0x0a, 0x22, 0x28, 0x13, 0x5f, 0x71, 0x6e, 0xe9, 0xbd, 0xee,
+ 0x7f, 0xc1, 0x3e, 0xc2, 0x7a, 0x03, 0xa6, 0xd1, 0x1c, 0x5c, 0x5b, 0x36,
+ 0x85, 0xf5, 0x19, 0x00, 0xb1, 0x33, 0x71, 0x53, 0xbc, 0x6c, 0x4e, 0x8f,
+ 0x52, 0x92, 0x0c, 0x33, 0xfa, 0x37, 0xf4, 0xe7
+};
+static const uint8_t ac_dsa_vect1_out[] = {
+/* R */
+ 0x50, 0xed, 0x0e, 0x81, 0x0e, 0x3f, 0x1c, 0x7c, 0xb6, 0xac, 0x62, 0x33,
+ 0x20, 0x58, 0x44, 0x8b, 0xd8, 0xb2, 0x84, 0xc0,
+/* S */
+ 0xc6, 0xad, 0xed, 0x17, 0x21, 0x6b, 0x46, 0xb7, 0xe4, 0xb6, 0xf2, 0xa9,
+ 0x7c, 0x1a, 0xd7, 0xcc, 0x3d, 0xa8, 0x3f, 0xde
+};
+
+/* SigGen.txt line 563 SHA-1 */
+#define ac_dsa_vect2_prime ac_dsa_vect1_prime
+#define ac_dsa_vect2_sub_prime ac_dsa_vect1_sub_prime
+#define ac_dsa_vect2_base ac_dsa_vect1_base
+static const uint8_t ac_dsa_vect2_pub_val[] = {
+ 0x29, 0xbd, 0xd7, 0x59, 0xaa, 0xa6, 0x2d, 0x4b, 0xf1, 0x6b, 0x48, 0x61,
+ 0xc8, 0x1c, 0xf4, 0x2e, 0xac, 0x2e, 0x16, 0x37, 0xb9, 0xec, 0xba, 0x51,
+ 0x2b, 0xdb, 0xc1, 0x3a, 0xc1, 0x2a, 0x80, 0xae, 0x8d, 0xe2, 0x52, 0x6b,
+ 0x89, 0x9a, 0xe5, 0xe4, 0xa2, 0x31, 0xae, 0xf8, 0x84, 0x19, 0x7c, 0x94,
+ 0x4c, 0x73, 0x26, 0x93, 0xa6, 0x34, 0xd7, 0x65, 0x9a, 0xbc, 0x69, 0x75,
+ 0xa7, 0x73, 0xf8, 0xd3, 0xcd, 0x5a, 0x36, 0x1f, 0xe2, 0x49, 0x23, 0x86,
+ 0xa3, 0xc0, 0x9a, 0xae, 0xf1, 0x2e, 0x4a, 0x7e, 0x73, 0xad, 0x7d, 0xfc,
+ 0x36, 0x37, 0xf7, 0xb0, 0x93, 0xf2, 0xc4, 0x0d, 0x62, 0x23, 0xa1, 0x95,
+ 0xc1, 0x36, 0xad, 0xf2, 0xea, 0x3f, 0xbf, 0x87, 0x04, 0xa6, 0x75, 0xaa,
+ 0x78, 0x17, 0xaa, 0x7e, 0xc7, 0xf9, 0xad, 0xfb, 0x28, 0x54, 0xd4, 0xe0,
+ 0x5c, 0x3c, 0xe7, 0xf7, 0x65, 0x60, 0x31, 0x3b
+};
+static const uint8_t ac_dsa_vect2_priv_val[] = {
+ 0xe6, 0x51, 0x31, 0xd7, 0x34, 0x70, 0xf6, 0xad, 0x2e, 0x58, 0x78, 0xbd,
+ 0xc9, 0xbe, 0xf5, 0x36, 0xfa, 0xf7, 0x88, 0x31
+};
+/* K = 87256a64e98cf5be1034ecfa766f9d25d1ac7ceb */
+static const uint8_t ac_dsa_vect2_ptx[] = {
+ 0xd2, 0xbc, 0xb5, 0x3b, 0x04, 0x4b, 0x3e, 0x2e, 0x4b, 0x61, 0xba, 0x2f,
+ 0x91, 0xc0, 0x99, 0x5f, 0xb8, 0x3a, 0x6a, 0x97, 0x52, 0x5e, 0x66, 0x44,
+ 0x1a, 0x3b, 0x48, 0x9d, 0x95, 0x94, 0x23, 0x8b, 0xc7, 0x40, 0xbd, 0xee,
+ 0xa0, 0xf7, 0x18, 0xa7, 0x69, 0xc9, 0x77, 0xe2, 0xde, 0x00, 0x38, 0x77,
+ 0xb5, 0xd7, 0xdc, 0x25, 0xb1, 0x82, 0xae, 0x53, 0x3d, 0xb3, 0x3e, 0x78,
+ 0xf2, 0xc3, 0xff, 0x06, 0x45, 0xf2, 0x13, 0x7a, 0xbc, 0x13, 0x7d, 0x4e,
+ 0x7d, 0x93, 0xcc, 0xf2, 0x4f, 0x60, 0xb1, 0x8a, 0x82, 0x0b, 0xc0, 0x7c,
+ 0x7b, 0x4b, 0x5f, 0xe0, 0x8b, 0x4f, 0x9e, 0x7d, 0x21, 0xb2, 0x56, 0xc1,
+ 0x8f, 0x3b, 0x9d, 0x49, 0xac, 0xc4, 0xf9, 0x3e, 0x2c, 0xe6, 0xf3, 0x75,
+ 0x4c, 0x78, 0x07, 0x75, 0x7d, 0x2e, 0x11, 0x76, 0x04, 0x26, 0x12, 0xcb,
+ 0x32, 0xfc, 0x3f, 0x4f, 0x70, 0x70, 0x0e, 0x25
+};
+static const uint8_t ac_dsa_vect2_out[] = {
+/* R */
+ 0xa2, 0x6c, 0x00, 0xb5, 0x75, 0x0a, 0x2d, 0x27, 0xfe, 0x74, 0x35, 0xb9,
+ 0x34, 0x76, 0xb3, 0x54, 0x38, 0xb4, 0xd8, 0xab,
+/* S */
+ 0x61, 0xc9, 0xbf, 0xcb, 0x29, 0x38, 0x75, 0x5a, 0xfa, 0x7d, 0xad, 0x1d,
+ 0x1e, 0x07, 0xc6, 0x28, 0x86, 0x17, 0xbf, 0x70
+};
+
+
+/*
+ * Test data from ftp://ftp.rsa.com/pub/rsalabs/tmp/pkcs1v15crypt-vectors.txt
+ *
+ * As specified in PKCS#1, the block type for this operation is 2.
+ * The seed value of each example provides the pseudo random bytes
+ * to be used for padding. This makes the result predictable.
+ */
+
+/* PKCS#1 v1.5 Signature Example 1 1024-bit RSA key pair */
+static const uint8_t ac_rsaes_pkcs1_v1_5_example1_modulus[] = {
+ 0xa8, 0xb3, 0xb2, 0x84, 0xaf, 0x8e, 0xb5, 0x0b, 0x38, 0x70, 0x34, 0xa8,
+ 0x60, 0xf1, 0x46, 0xc4, 0x91, 0x9f, 0x31, 0x87, 0x63, 0xcd, 0x6c, 0x55,
+ 0x98, 0xc8, 0xae, 0x48, 0x11, 0xa1, 0xe0, 0xab, 0xc4, 0xc7, 0xe0, 0xb0,
+ 0x82, 0xd6, 0x93, 0xa5, 0xe7, 0xfc, 0xed, 0x67, 0x5c, 0xf4, 0x66, 0x85,
+ 0x12, 0x77, 0x2c, 0x0c, 0xbc, 0x64, 0xa7, 0x42, 0xc6, 0xc6, 0x30, 0xf5,
+ 0x33, 0xc8, 0xcc, 0x72, 0xf6, 0x2a, 0xe8, 0x33, 0xc4, 0x0b, 0xf2, 0x58,
+ 0x42, 0xe9, 0x84, 0xbb, 0x78, 0xbd, 0xbf, 0x97, 0xc0, 0x10, 0x7d, 0x55,
+ 0xbd, 0xb6, 0x62, 0xf5, 0xc4, 0xe0, 0xfa, 0xb9, 0x84, 0x5c, 0xb5, 0x14,
+ 0x8e, 0xf7, 0x39, 0x2d, 0xd3, 0xaa, 0xff, 0x93, 0xae, 0x1e, 0x6b, 0x66,
+ 0x7b, 0xb3, 0xd4, 0x24, 0x76, 0x16, 0xd4, 0xf5, 0xba, 0x10, 0xd4, 0xcf,
+ 0xd2, 0x26, 0xde, 0x88, 0xd3, 0x9f, 0x16, 0xfb
+};
+static const uint8_t ac_rsaes_pkcs1_v1_5_example1_pub_exp[] = {
+ 0x01, 0x00, 0x01
+};
+static const uint8_t ac_rsaes_pkcs1_v1_5_example1_priv_exp[] = {
+ 0x53, 0x33, 0x9c, 0xfd, 0xb7, 0x9f, 0xc8, 0x46, 0x6a, 0x65, 0x5c, 0x73,
+ 0x16, 0xac, 0xa8, 0x5c, 0x55, 0xfd, 0x8f, 0x6d, 0xd8, 0x98, 0xfd, 0xaf,
+ 0x11, 0x95, 0x17, 0xef, 0x4f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v1_5_example1_prime2[] = {
+ 0xcc, 0x88, 0x53, 0xd1, 0xd5, 0x4d, 0xa6, 0x30, 0xfa, 0xc0, 0x04, 0xf4,
+ 0x71, 0xf2, 0x81, 0xc7, 0xb8, 0x98, 0x2d, 0x82, 0x24, 0xa4, 0x90, 0xed,
+ 0xbe, 0xb3, 0x3d, 0x3e, 0x3d, 0x5c, 0xc9, 0x3c, 0x47, 0x65, 0x70, 0x3d,
+ 0x1d, 0xd7, 0x91, 0x64, 0x2f, 0x1f, 0x11, 0x6a, 0x0d, 0xd8, 0x52, 0xbe,
+ 0x24, 0x19, 0xb2, 0xaf, 0x72, 0xbf, 0xe9, 0xa0, 0x30, 0xe8, 0x60, 0xb0,
+ 0x28, 0x8b, 0x5d, 0x77
+};
+static const uint8_t ac_rsaes_pkcs1_v1_5_example1_exp1[] = {
+ 0x0e, 0x12, 0xbf, 0x17, 0x18, 0xe9, 0xce, 0xf5, 0x59, 0x9b, 0xa1, 0xc3,
+ 0x88, 0x2f, 0xe8, 0x04, 0x6a, 0x90, 0x87, 0x4e, 0xef, 0xce, 0x8f, 0x2c,
+ 0xcc, 0x20, 0xe4, 0xf2, 0x74, 0x1f, 0xb0, 0xa3, 0x3a, 0x38, 0x48, 0xae,
+ 0xc9, 0xc9, 0x30, 0x5f, 0xbe, 0xcb, 0xd2, 0xd7, 0x68, 0x19, 0x96, 0x7d,
+ 0x46, 0x71, 0xac, 0xc6, 0x43, 0x1e, 0x40, 0x37, 0x96, 0x8d, 0xb3, 0x78,
+ 0x78, 0xe6, 0x95, 0xc1
+};
+static const uint8_t ac_rsaes_pkcs1_v1_5_example1_exp2[] = {
+ 0x95, 0x29, 0x7b, 0x0f, 0x95, 0xa2, 0xfa, 0x67, 0xd0, 0x07, 0x07, 0xd6,
+ 0x09, 0xdf, 0xd4, 0xfc, 0x05, 0xc8, 0x9d, 0xaf, 0xc2, 0xef, 0x6d, 0x6e,
+ 0xa5, 0x5b, 0xec, 0x77, 0x1e, 0xa3, 0x33, 0x73, 0x4d, 0x92, 0x51, 0xe7,
+ 0x90, 0x82, 0xec, 0xda, 0x86, 0x6e, 0xfe, 0xf1, 0x3c, 0x45, 0x9e, 0x1a,
+ 0x63, 0x13, 0x86, 0xb7, 0xe3, 0x54, 0xc8, 0x99, 0xf5, 0xf1, 0x12, 0xca,
+ 0x85, 0xd7, 0x15, 0x83
+};
+static const uint8_t ac_rsaes_pkcs1_v1_5_example1_coeff[] = {
+ 0x4f, 0x45, 0x6c, 0x50, 0x24, 0x93, 0xbd, 0xc0, 0xed, 0x2a, 0xb7, 0x56,
+ 0xa3, 0xa6, 0xed, 0x4d, 0x67, 0x35, 0x2a, 0x69, 0x7d, 0x42, 0x16, 0xe9,
+ 0x32, 0x12, 0xb1, 0x27, 0xa6, 0x3d, 0x54, 0x11, 0xce, 0x6f, 0xa9, 0x8d,
+ 0x5d, 0xbe, 0xfd, 0x73, 0x26, 0x3e, 0x37, 0x28, 0x14, 0x27, 0x43, 0x81,
+ 0x81, 0x66, 0xed, 0x7d, 0xd6, 0x36, 0x87, 0xdd, 0x2a, 0x8c, 0xa1, 0xd2,
+ 0xf4, 0xfb, 0xd8, 0xe1
+};
+
+
+/* PKCS#1 v1.5 Encrypt Example 1.1 */
+#define ac_rsaes_pkcs1_v1_5_vect1_modulus ac_rsaes_pkcs1_v1_5_example1_modulus
+#define ac_rsaes_pkcs1_v1_5_vect1_pub_exp ac_rsaes_pkcs1_v1_5_example1_pub_exp
+#define ac_rsaes_pkcs1_v1_5_vect1_priv_exp ac_rsaes_pkcs1_v1_5_example1_priv_exp
+#define ac_rsaes_pkcs1_v1_5_vect1_prime1 ac_rsaes_pkcs1_v1_5_example1_prime1
+#define ac_rsaes_pkcs1_v1_5_vect1_prime2 ac_rsaes_pkcs1_v1_5_example1_prime2
+#define ac_rsaes_pkcs1_v1_5_vect1_exp1 ac_rsaes_pkcs1_v1_5_example1_exp1
+#define ac_rsaes_pkcs1_v1_5_vect1_exp2 ac_rsaes_pkcs1_v1_5_example1_exp2
+#define ac_rsaes_pkcs1_v1_5_vect1_coeff ac_rsaes_pkcs1_v1_5_example1_coeff
+static const uint8_t ac_rsaes_pkcs1_v1_5_vect1_ptx[] = {
+ 0x66, 0x28, 0x19, 0x4e, 0x12, 0x07, 0x3d, 0xb0, 0x3b, 0xa9, 0x4c, 0xda,
+ 0x9e, 0xf9, 0x53, 0x23,
+ 0x97, 0xd5, 0x0d, 0xba, 0x79, 0xb9, 0x87, 0x00, 0x4a, 0xfe, 0xfe, 0x34,
+};
+static const uint8_t ac_rsaes_pkcs1_v1_5_vect1_out[] = {
+ 0x50, 0xb4, 0xc1, 0x41, 0x36, 0xbd, 0x19, 0x8c, 0x2f, 0x3c, 0x3e, 0xd2,
+ 0x43, 0xfc, 0xe0, 0x36,
+ 0xe1, 0x68, 0xd5, 0x65, 0x17, 0x98, 0x4a, 0x26, 0x3c, 0xd6, 0x64, 0x92,
+ 0xb8, 0x08, 0x04, 0xf1,
+ 0x69, 0xd2, 0x10, 0xf2, 0xb9, 0xbd, 0xfb, 0x48, 0xb1, 0x2f, 0x9e, 0xa0,
+ 0x50, 0x09, 0xc7, 0x7d,
+ 0xa2, 0x57, 0xcc, 0x60, 0x0c, 0xce, 0xfe, 0x3a, 0x62, 0x83, 0x78, 0x9d,
+ 0x8e, 0xa0, 0xe6, 0x07,
+ 0xac, 0x58, 0xe2, 0x69, 0x0e, 0xc4, 0xeb, 0xc1, 0x01, 0x46, 0xe8, 0xcb,
+ 0xaa, 0x5e, 0xd4, 0xd5,
+ 0xcc, 0xe6, 0xfe, 0x7b, 0x0f, 0xf9, 0xef, 0xc1, 0xea, 0xbb, 0x56, 0x4d,
+ 0xbf, 0x49, 0x82, 0x85,
+ 0xf4, 0x49, 0xee, 0x61, 0xdd, 0x7b, 0x42, 0xee, 0x5b, 0x58, 0x92, 0xcb,
+ 0x90, 0x60, 0x1f, 0x30,
+ 0xcd, 0xa0, 0x7b, 0xf2, 0x64, 0x89, 0x31, 0x0b, 0xcd, 0x23, 0xb5, 0x28,
+ 0xce, 0xab, 0x3c, 0x31,
+};
+
+
+/* PKCS#1 v1.5 Encrypt Example 1.2 */
+#define ac_rsaes_pkcs1_v1_5_vect2_modulus ac_rsaes_pkcs1_v1_5_example1_modulus
+#define ac_rsaes_pkcs1_v1_5_vect2_pub_exp ac_rsaes_pkcs1_v1_5_example1_pub_exp
+#define ac_rsaes_pkcs1_v1_5_vect2_priv_exp ac_rsaes_pkcs1_v1_5_example1_priv_exp
+#define ac_rsaes_pkcs1_v1_5_vect2_prime1 ac_rsaes_pkcs1_v1_5_example1_prime1
+#define ac_rsaes_pkcs1_v1_5_vect2_prime2 ac_rsaes_pkcs1_v1_5_example1_prime2
+#define ac_rsaes_pkcs1_v1_5_vect2_exp1 ac_rsaes_pkcs1_v1_5_example1_exp1
+#define ac_rsaes_pkcs1_v1_5_vect2_exp2 ac_rsaes_pkcs1_v1_5_example1_exp2
+#define ac_rsaes_pkcs1_v1_5_vect2_coeff ac_rsaes_pkcs1_v1_5_example1_coeff
+static const uint8_t ac_rsaes_pkcs1_v1_5_vect2_ptx[] = {
+ 0x75, 0x0c, 0x40, 0x47, 0xf5, 0x47, 0xe8, 0xe4, 0x14, 0x11, 0x85, 0x65,
+ 0x23, 0x29, 0x8a, 0xc9, 0xba, 0xe2, 0x45, 0xef, 0xaf, 0x13, 0x97, 0xfb,
+ 0xe5, 0x6f, 0x9d, 0xd5
+};
+static const uint8_t ac_rsaes_pkcs1_v1_5_vect2_out[] = {
+ 0x68, 0x42, 0xe5, 0xe2, 0xcc, 0x00, 0x41, 0xd6, 0xb0, 0xc8, 0x1a, 0x56,
+ 0x2c, 0x39, 0xa6, 0x17, 0x37, 0x9a, 0x51, 0x5c, 0xab, 0x74, 0xab, 0xcb,
+ 0x26, 0x19, 0xc7, 0x74, 0x0a, 0x54, 0x1d, 0x95, 0x55, 0xdd, 0x91, 0x65,
+ 0x97, 0x5b, 0xf8, 0xa3, 0xeb, 0xd0, 0xd0, 0x45, 0x66, 0x61, 0xdf, 0xb1,
+ 0xa6, 0x86, 0x1b, 0xa2, 0x33, 0x22, 0x69, 0x93, 0x0e, 0x0d, 0xb5, 0x14,
+ 0xfc, 0xa0, 0x73, 0x3e, 0xeb, 0x9c, 0x40, 0x57, 0x13, 0xeb, 0x1f, 0x9d,
+ 0x76, 0x80, 0x33, 0xed, 0x29, 0x3e, 0x1e, 0x08, 0x1a, 0x12, 0x5f, 0x32,
+ 0xdd, 0xb9, 0xea, 0x52, 0xed, 0xbe, 0x27, 0x5c, 0x4a, 0xf6, 0x0f, 0x8a,
+ 0x7b, 0xf8, 0x32, 0xbd, 0x22, 0x75, 0x61, 0xc2, 0x08, 0xdc, 0x00, 0x31,
+ 0xa8, 0x4b, 0x50, 0x12, 0xc9, 0xdd, 0x9f, 0x74, 0x45, 0x9d, 0xcb, 0x07,
+ 0x0b, 0xdb, 0xe1, 0x3c, 0xfa, 0x8c, 0x2d, 0x50
+};
+
+/*
+ * Test data from ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip
+ *
+ * The underlying hash function is SHA-1; the mask generation function is
+ * MGF1 with SHA-1 as specified in PKCS #1 v2.1.
+ */
+
+/* Example 1: A 1024-bit RSA Key Pair */
+#define ac_rsaes_oaep_example1_modulus ac_rsaes_pkcs1_v1_5_example1_modulus
+#define ac_rsaes_oaep_example1_pub_exp ac_rsaes_pkcs1_v1_5_example1_pub_exp
+#define ac_rsaes_oaep_example1_priv_exp ac_rsaes_pkcs1_v1_5_example1_priv_exp
+#define ac_rsaes_oaep_example1_prime1 ac_rsaes_pkcs1_v1_5_example1_prime1
+#define ac_rsaes_oaep_example1_prime2 ac_rsaes_pkcs1_v1_5_example1_prime2
+#define ac_rsaes_oaep_example1_exp1 ac_rsaes_pkcs1_v1_5_example1_exp1
+#define ac_rsaes_oaep_example1_exp2 ac_rsaes_pkcs1_v1_5_example1_exp2
+#define ac_rsaes_oaep_example1_coeff ac_rsaes_pkcs1_v1_5_example1_coeff
+
+
+/* RSAES-OAEP Encryption Example 1.1 */
+#define ac_rsaes_oaep_vect1_modulus ac_rsaes_oaep_example1_modulus
+#define ac_rsaes_oaep_vect1_pub_exp ac_rsaes_oaep_example1_pub_exp
+#define ac_rsaes_oaep_vect1_priv_exp ac_rsaes_oaep_example1_priv_exp
+#define ac_rsaes_oaep_vect1_prime1 ac_rsaes_oaep_example1_prime1
+#define ac_rsaes_oaep_vect1_prime2 ac_rsaes_oaep_example1_prime2
+#define ac_rsaes_oaep_vect1_exp1 ac_rsaes_oaep_example1_exp1
+#define ac_rsaes_oaep_vect1_exp2 ac_rsaes_oaep_example1_exp2
+#define ac_rsaes_oaep_vect1_coeff ac_rsaes_oaep_example1_coeff
+static const uint8_t ac_rsaes_oaep_vect1_ptx[] = {
+ 0x66, 0x28, 0x19, 0x4e, 0x12, 0x07, 0x3d, 0xb0, 0x3b, 0xa9, 0x4c, 0xda,
+ 0x9e, 0xf9, 0x53, 0x23, 0x97, 0xd5, 0x0d, 0xba, 0x79, 0xb9, 0x87, 0x00,
+ 0x4a, 0xfe, 0xfe, 0x34,
+};
+static const uint8_t ac_rsaes_oaep_vect1_out[] = {
+ 0x35, 0x4f, 0xe6, 0x7b, 0x4a, 0x12, 0x6d, 0x5d, 0x35, 0xfe, 0x36, 0xc7,
+ 0x77, 0x79, 0x1a, 0x3f, 0x7b, 0xa1, 0x3d, 0xef, 0x48, 0x4e, 0x2d, 0x39,
+ 0x08, 0xaf, 0xf7, 0x22, 0xfa, 0xd4, 0x68, 0xfb, 0x21, 0x69, 0x6d, 0xe9,
+ 0x5d, 0x0b, 0xe9, 0x11, 0xc2, 0xd3, 0x17, 0x4f, 0x8a, 0xfc, 0xc2, 0x01,
+ 0x03, 0x5f, 0x7b, 0x6d, 0x8e, 0x69, 0x40, 0x2d, 0xe5, 0x45, 0x16, 0x18,
+ 0xc2, 0x1a, 0x53, 0x5f, 0xa9, 0xd7, 0xbf, 0xc5, 0xb8, 0xdd, 0x9f, 0xc2,
+ 0x43, 0xf8, 0xcf, 0x92, 0x7d, 0xb3, 0x13, 0x22, 0xd6, 0xe8, 0x81, 0xea,
+ 0xa9, 0x1a, 0x99, 0x61, 0x70, 0xe6, 0x57, 0xa0, 0x5a, 0x26, 0x64, 0x26,
+ 0xd9, 0x8c, 0x88, 0x00, 0x3f, 0x84, 0x77, 0xc1, 0x22, 0x70, 0x94, 0xa0,
+ 0xd9, 0xfa, 0x1e, 0x8c, 0x40, 0x24, 0x30, 0x9c, 0xe1, 0xec, 0xcc, 0xb5,
+ 0x21, 0x00, 0x35, 0xd4, 0x7a, 0xc7, 0x2e, 0x8a
+};
+
+/* RSAES-OAEP Encryption Example 1.2 */
+#define ac_rsaes_oaep_vect2_modulus ac_rsaes_oaep_example1_modulus
+#define ac_rsaes_oaep_vect2_pub_exp ac_rsaes_oaep_example1_pub_exp
+#define ac_rsaes_oaep_vect2_priv_exp ac_rsaes_oaep_example1_priv_exp
+#define ac_rsaes_oaep_vect2_prime1 ac_rsaes_oaep_example1_prime1
+#define ac_rsaes_oaep_vect2_prime2 ac_rsaes_oaep_example1_prime2
+#define ac_rsaes_oaep_vect2_exp1 ac_rsaes_oaep_example1_exp1
+#define ac_rsaes_oaep_vect2_exp2 ac_rsaes_oaep_example1_exp2
+#define ac_rsaes_oaep_vect2_coeff ac_rsaes_oaep_example1_coeff
+static const uint8_t ac_rsaes_oaep_vect2_ptx[] = {
+ 0x75, 0x0c, 0x40, 0x47, 0xf5, 0x47, 0xe8, 0xe4, 0x14, 0x11, 0x85, 0x65,
+ 0x23, 0x29, 0x8a, 0xc9, 0xba, 0xe2, 0x45, 0xef, 0xaf, 0x13, 0x97, 0xfb,
+ 0xe5, 0x6f, 0x9d, 0xd5
+};
+static const uint8_t ac_rsaes_oaep_vect2_out[] = {
+ 0x64, 0x0d, 0xb1, 0xac, 0xc5, 0x8e, 0x05, 0x68, 0xfe, 0x54, 0x07, 0xe5,
+ 0xf9, 0xb7, 0x01, 0xdf, 0xf8, 0xc3, 0xc9, 0x1e, 0x71, 0x6c, 0x53, 0x6f,
+ 0xc7, 0xfc, 0xec, 0x6c, 0xb5, 0xb7, 0x1c, 0x11, 0x65, 0x98, 0x8d, 0x4a,
+ 0x27, 0x9e, 0x15, 0x77, 0xd7, 0x30, 0xfc, 0x7a, 0x29, 0x93, 0x2e, 0x3f,
+ 0x00, 0xc8, 0x15, 0x15, 0x23, 0x6d, 0x8d, 0x8e, 0x31, 0x01, 0x7a, 0x7a,
+ 0x09, 0xdf, 0x43, 0x52, 0xd9, 0x04, 0xcd, 0xeb, 0x79, 0xaa, 0x58, 0x3a,
+ 0xdc, 0xc3, 0x1e, 0xa6, 0x98, 0xa4, 0xc0, 0x52, 0x83, 0xda, 0xba, 0x90,
+ 0x89, 0xbe, 0x54, 0x91, 0xf6, 0x7c, 0x1a, 0x4e, 0xe4, 0x8d, 0xc7, 0x4b,
+ 0xbb, 0xe6, 0x64, 0x3a, 0xef, 0x84, 0x66, 0x79, 0xb4, 0xcb, 0x39, 0x5a,
+ 0x35, 0x2d, 0x5e, 0xd1, 0x15, 0x91, 0x2d, 0xf6, 0x96, 0xff, 0xe0, 0x70,
+ 0x29, 0x32, 0x94, 0x6d, 0x71, 0x49, 0x2b, 0x44
+};
+
+/*
+ * PKCS#1 v1.5 Signature Example 15 2048-bit RSA key pair
+ * from http://armcryptolib.das-labor.org/trac/browser/testvectors/rsa-pkcs-1v2-1-vec/oaep-vect.txt
+ */
+static const uint8_t ac_rsaes_pkcs1_v1_5_example15_modulus[] = {
+ 0xdc, 0xfa, 0x10, 0xff, 0xa7, 0x46, 0x65, 0xae, 0xef, 0x87, 0x09, 0x74, 0xea, 0x99, 0xb2, 0xce,
+ 0x54, 0x54, 0x7c, 0x67, 0xf4, 0x2a, 0xaa, 0x6d, 0xd0, 0x1a, 0x2e, 0xd3, 0x1f, 0xd2, 0xc2, 0x42,
+ 0xaf, 0x5d, 0x96, 0x0b, 0x1f, 0x89, 0x6e, 0xfb, 0x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xd1, 0xaa, 0x47, 0x3e,
+ 0xd1, 0x18, 0x7e, 0xc1, 0xd8, 0xa7, 0x44, 0xea, 0x34, 0x5b, 0xed, 0x7e, 0xa0, 0x0e, 0xe4, 0xe8,
+ 0x1b, 0xba, 0x46, 0x48, 0x60, 0x1d, 0xd5, 0x37, 0xdc, 0x91, 0x01, 0x5d, 0x31, 0xf0, 0xc2, 0xc1,
+};
+
+static const uint8_t ac_rsaes_pkcs1_v1_5_example15_pub_exp[] = {
+ 0x01, 0x00, 0x01,
+};
+
+static const uint8_t ac_rsaes_pkcs1_v1_5_example15_priv_exp[] = {
+ 0x21, 0x95, 0x08, 0x51, 0xcd, 0xf2, 0x53, 0x20, 0x31, 0x8b, 0x30, 0x5a, 0xfa, 0x0f, 0x37, 0x1f,
+ 0x07, 0xae, 0x5a, 0x44, 0xb3, 0x14, 0xeb, 0xd7, 0x29, 0xf5, 0xdc, 0xb1, 0x5d, 0xa7, 0xfa, 0x39,
+ 0x47, 0xac, 0xdd, 0x91, 0x5d, 0xae, 0xd5, 0x74, 0xbd, 0x16, 0xdf, 0x88, 0xbf, 0x85, 0xf6, 0x10,
+ 0x60, 0xb3, 0x87, 0x17, 0x2f, 0xae, 0x6e, 0x01, 0x26, 0x2b, 0x38, 0x64, 0xc2, 0xd3, 0xc2, 0x2f,
+ 0x94, 0xe0, 0x4a, 0x81, 0x59, 0x42, 0x2b, 0x4e, 0xd2, 0x79, 0xc4, 0x8a, 0x4c, 0x9d, 0x76, 0x7d,
+ 0x49, 0x66, 0x07, 0x1a, 0x5b, 0xbf, 0x5d, 0x04, 0x3e, 0x16, 0xff, 0x46, 0xec, 0x1b, 0xa0, 0x71,
+ 0x6f, 0x00, 0xbb, 0xc9, 0x7b, 0xff, 0x5d, 0x56, 0x93, 0xe2, 0x14, 0xe9, 0x9c, 0x97, 0x21, 0xf1,
+ 0x2b, 0x3e, 0xc6, 0x28, 0x2a, 0xe2, 0xa4, 0x85, 0x72, 0x1b, 0x96, 0xdd,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d0, 0xcf, 0x0a, 0xc0, 0x4d,
+};
+
+static const uint8_t ac_rsaes_pkcs1_v1_5_example15_exp2[] = {
+ 0x52, 0x81, 0x71, 0x23, 0x3c, 0x4e, 0x4a, 0x6c, 0x63, 0xb8, 0x67, 0x64, 0xf5, 0x13, 0x38, 0x84,
+ 0x6a, 0xfd, 0xdb, 0xcb, 0x29, 0x58, 0x34, 0x4c, 0x01, 0xc4, 0x00, 0x4a, 0x1d, 0xd8, 0x28, 0x14,
+ 0x5a, 0x1d, 0x02, 0xa1, 0x50, 0x7d, 0xef, 0x4f, 0x58, 0x24, 0x7a, 0x64, 0xfc, 0x10, 0xc0, 0xa2,
+ 0x88, 0xc1, 0xae, 0x89, 0x57, 0x21, 0xd7, 0x8b, 0x8f, 0x04, 0x4d, 0xb7, 0xc0, 0x0d, 0x86, 0xda,
+ 0x55, 0xa9, 0xb6, 0x54, 0x29, 0x2e, 0xcd, 0x76, 0x82, 0x70, 0xbe, 0x69, 0xe4, 0xbd, 0x59, 0x22,
+ 0xd4, 0xef, 0xfd, 0x1f, 0x70, 0x95, 0x5f, 0x96, 0x27, 0xe3, 0xe1, 0x9b, 0x74, 0x9e, 0x93, 0xb4,
+ 0x0e, 0xf3, 0xdd, 0x1d, 0x61, 0xd9, 0x39, 0x15, 0xe2, 0xb0, 0x9d, 0x93, 0x0b, 0x4b, 0x17, 0x68,
+ 0xbf, 0xac, 0xc0, 0x13, 0x6f, 0x39, 0xb0, 0xcf, 0xdf, 0xb4, 0xd0, 0x50, 0x01, 0x1e, 0x2e, 0x65,
+};
+
+static const uint8_t ac_rsaes_pkcs1_v1_5_example15_coeff[] = {
+ 0xdf, 0x2e, 0xb2, 0x32, 0x2c, 0xc2, 0xda, 0xab, 0xf4, 0xd1, 0x46, 0x55, 0x08, 0xf4, 0x15, 0x21,
+ 0xcd, 0xa7, 0xce, 0xff, 0x23, 0xeb, 0xe6, 0x1d, 0x00, 0xd4, 0x41, 0xee, 0x72, 0x8d, 0xda, 0x5d,
+ 0x16, 0xc7, 0xbf, 0x92, 0x0c, 0xd9, 0x5f, 0x34, 0xbe, 0xb4, 0xfe, 0x32, 0xee, 0x81, 0x7e, 0xf3,
+ 0x36, 0x2e, 0x0b, 0xcd, 0x1d, 0x12, 0x45, 0xf7, 0xb0, 0x77, 0x93, 0xea, 0xa1, 0x90, 0xdc, 0x5a,
+ 0x37, 0xfd, 0xaf, 0x4c, 0x68, 0xe2, 0xca, 0x13, 0x97, 0x2d, 0x7f, 0x51, 0x48, 0xb7, 0x96, 0xb6,
+ 0xfb, 0x6d, 0x7a, 0xdd, 0xa0, 0x7b, 0xd2, 0xcd, 0x13, 0xbe, 0x98, 0xce, 0xbe, 0xd1, 0xed, 0xc6,
+ 0xca, 0x41, 0x2e, 0x39, 0x53, 0x50, 0xc5, 0x9a, 0x1d, 0x84, 0x2b, 0xc4, 0xaa, 0x2f, 0x3c, 0x0b,
+ 0x24, 0x3f, 0xde, 0x7d, 0xfd, 0x95, 0x35, 0x6f, 0x24, 0x39, 0x25, 0x1a, 0x11, 0x72, 0xc4, 0x5e,
+};
+
+/* PKCS#1 v1.5 Encrypt Example 15.9 */
+#define ac_rsaes_pkcs1_v1_5_vect15_modulus ac_rsaes_pkcs1_v1_5_example15_modulus
+#define ac_rsaes_pkcs1_v1_5_vect15_pub_exp ac_rsaes_pkcs1_v1_5_example15_pub_exp
+#define ac_rsaes_pkcs1_v1_5_vect15_priv_exp ac_rsaes_pkcs1_v1_5_example15_priv_exp
+#define ac_rsaes_pkcs1_v1_5_vect15_prime1 ac_rsaes_pkcs1_v1_5_example15_prime1
+#define ac_rsaes_pkcs1_v1_5_vect15_prime2 ac_rsaes_pkcs1_v1_5_example15_prime2
+#define ac_rsaes_pkcs1_v1_5_vect15_exp1 ac_rsaes_pkcs1_v1_5_example15_exp1
+#define ac_rsaes_pkcs1_v1_5_vect15_exp2 ac_rsaes_pkcs1_v1_5_example15_exp2
+#define ac_rsaes_pkcs1_v1_5_vect15_coeff ac_rsaes_pkcs1_v1_5_example15_coeff
+
+/*
+ * PKCS#1 v1.5 Encryption Example 15.9
+ * from ftp://ftp.rsa.com/pub/rsalabs/tmp/pkcs1v15crypt-vectors.txt
+ */
+static const uint8_t ac_rsaes_pkcs1_v1_5_vect15_ptx[] = {
+ 0x9a, 0x13, 0x96, 0x62, 0x2d, 0x06, 0x6c, 0x10, 0x56, 0x08, 0x58, 0xc2, 0xc4, 0xcd, 0x5c, 0x04,
+ 0x44, 0x9e, 0x2b, 0x95, 0x50, 0xc5, 0xbc, 0x92, 0x93, 0x76, 0x1a, 0x91, 0x04, 0x41, 0x1d, 0xa1,
+ 0x8a, 0x57, 0xd9, 0xb6, 0xa9, 0x97, 0x33, 0x3c, 0xdb, 0xce, 0x77, 0xe9, 0xfd, 0xbe, 0x6b, 0xb8,
+ 0x31,
+};
+
+static const uint8_t ac_rsaes_pkcs1_v1_5_vect15_out[] = {
+ 0x10, 0x0e, 0xce, 0x63, 0x45, 0x25, 0xd4, 0x67, 0xf6, 0xd4, 0xa6, 0xb6, 0x6e, 0xde, 0x1c, 0xc2,
+ 0x37, 0xf6, 0x1f, 0xb2, 0xb6, 0x70, 0x23, 0xa8, 0x3d, 0xc4, 0x56, 0xb9, 0x2c, 0xda, 0x18, 0x3e,
+ 0xd6, 0x62, 0x0f, 0xe5, 0x7d, 0x5a, 0x67, 0x33, 0x2c, 0x77, 0x23, 0x3a, 0xc1, 0xe8, 0x72, 0x5b,
+ 0x36, 0xf8, 0xe1, 0xb1, 0x08, 0x41, 0x2c, 0xa6, 0xfb, 0x35, 0xdc, 0xd4, 0xd8, 0x16, 0x77, 0xa2,
+ 0xb3, 0x0d, 0x5e, 0xaf, 0x25, 0xe0, 0xb9, 0x19, 0x1b, 0x38, 0xf7, 0xee, 0xf8, 0x3f, 0x91, 0x21,
+ 0xa8, 0x08, 0x43, 0x8c, 0x92, 0xab, 0x03, 0xf5, 0x20, 0x80, 0x7b, 0xc9, 0xa8, 0x94, 0x70, 0x5e,
+ 0xaf, 0x4e, 0xed, 0x06, 0x68, 0x23, 0xa6, 0x7a, 0xa2, 0xa5, 0x59, 0x9c, 0xd9, 0x5e, 0x58, 0xda,
+ 0x7c, 0x09, 0x48, 0x36, 0xd2, 0xaf, 0xeb, 0xa3, 0x9d, 0xd0, 0x09, 0xa6, 0x4a, 0xde, 0x03, 0x05,
+ 0x33, 0x76, 0xf0, 0x29, 0x36, 0xcf, 0x3f, 0x56, 0xbf, 0x64, 0xc1, 0xf3, 0xbd, 0xc0, 0x7c, 0x45,
+ 0xa9, 0x5b, 0x9f, 0xcd, 0x93, 0x96, 0xcd, 0x9a, 0x8d, 0x41, 0xbc, 0xc5, 0x64, 0x24, 0x93, 0x7a,
+ 0x13, 0x71, 0xb3, 0x84, 0x7c, 0x90, 0x5b, 0x9a, 0xb5, 0x84, 0x02, 0x39, 0x3d, 0x40, 0x46, 0xe4,
+ 0xa0, 0x15, 0xc1, 0x47, 0x08, 0xf7, 0x4c, 0xe7, 0x79, 0x0e, 0xba, 0x8a, 0xf7, 0x92, 0x07, 0x24,
+ 0x40, 0xbc, 0xaf, 0xb1, 0x4c, 0x0f, 0x81, 0x08, 0x97, 0x11, 0x87, 0xc8, 0x0f, 0x46, 0x3a, 0x1f,
+ 0xff, 0x25, 0x86, 0x46, 0xea, 0x16, 0xe5, 0x1c, 0x6e, 0xe3, 0x61, 0xb6, 0x61, 0xa1, 0x4f, 0x07,
+ 0xcd, 0x4f, 0x5a, 0x82, 0xc7, 0x09, 0xf4, 0x94, 0xf1, 0xdf, 0x0f, 0x80, 0x3b, 0x6f, 0x64, 0xa7,
+ 0x2f, 0xb9, 0xc4, 0x50, 0xff, 0xe2, 0x68, 0xfc, 0xab, 0x48, 0x7d, 0x4d, 0x63, 0x01, 0x3e, 0x41,
+};
+
+/*
+ * PKCS#1 v1.5 Encryption Example 10.1
+ * from http://armcryptolib.das-labor.org/trac/browser/testvectors/rsa-pkcs-1v2-1-vec/oaep-vect.txt
+ */
+
+static const uint8_t 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
+
+static const uint8_t ac_rsaes_oaep_vect10_prime1[] = {
+ 0xec, 0xf5, 0xae, 0xcd, 0x1e, 0x55, 0x15, 0xff, 0xfa, 0xcb, 0xd7, 0x5a, 0x28, 0x16, 0xc6, 0xeb,
+ 0xf4, 0x90, 0x18, 0xcd, 0xfb, 0x46, 0x38, 0xe1, 0x85, 0xd6, 0x6a, 0x73, 0x96, 0xb6, 0xf8, 0x09,
+ 0x0f, 0x80, 0x18, 0xc7, 0xfd, 0x95, 0xcc, 0x34, 0xb8, 0x57, 0xdc, 0x17, 0xf0, 0xcc, 0x65, 0x16,
+ 0xbb, 0x13, 0x46, 0xab, 0x4d, 0x58, 0x2c, 0xad, 0xad, 0x7b, 0x41, 0x03, 0x35, 0x23, 0x87, 0xb7,
+ 0x03, 0x38, 0xd0, 0x84, 0x04, 0x7c, 0x9d, 0x95, 0x39, 0xb6, 0x49, 0x62, 0x04, 0xb3, 0xdd, 0x6e,
+ 0xa4, 0x42, 0x49, 0x92, 0x07, 0xbe, 0xc0, 0x1f, 0x96, 0x42, 0x87, 0xff, 0x63, 0x36, 0xc3, 0x98,
+ 0x46, 0x58, 0x33, 0x68, 0x46, 0xf5, 0x6e, 0x46, 0x86, 0x18, 0x81, 0xc1, 0x02, 0x33, 0xd2, 0x17,
+ 0x6b, 0xf1, 0x5a, 0x5e, 0x96, 0xdd, 0xc7, 0x80, 0xbc, 0x86, 0x8a, 0xa7, 0x7d, 0x3c, 0xe7, 0x69,
+};
+
+static const uint8_t ac_rsaes_oaep_vect10_prime2[] = {
+ 0xbc, 0x46, 0xc4, 0x64, 0xfc, 0x6a, 0xc4, 0xca, 0x78, 0x3b, 0x0e, 0xb0, 0x8a, 0x3c, 0x84, 0x1b,
+ 0x77, 0x2f, 0x7e, 0x9b, 0x2f, 0x28, 0xba, 0xbd, 0x58, 0x8a, 0xe8, 0x85, 0xe1, 0xa0, 0xc6, 0x1e,
+ 0x48, 0x58, 0xa0, 0xfb, 0x25, 0xac, 0x29, 0x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 0x5e, 0x49,
+};
+
+static const uint8_t ac_rsaes_oaep_vect10_coeff[] = {
+ 0x6f, 0x38, 0x52, 0x6b, 0x39, 0x25, 0x08, 0x55, 0x34, 0xef, 0x3e, 0x41, 0x5a, 0x83, 0x6e, 0xde,
+ 0x8b, 0x86, 0x15, 0x8a, 0x2c, 0x7c, 0xbf, 0xec, 0xcb, 0x0b, 0xd8, 0x34, 0x30, 0x4f, 0xec, 0x68,
+ 0x3b, 0xa8, 0xd4, 0xf4, 0x79, 0xc4, 0x33, 0xd4, 0x34, 0x16, 0xe6, 0x32, 0x69, 0x62, 0x3c, 0xea,
+ 0x10, 0x07, 0x76, 0xd8, 0x5a, 0xff, 0x40, 0x1d, 0x3f, 0xff, 0x61, 0x0e, 0xe6, 0x54, 0x11, 0xce,
+ 0x3b, 0x13, 0x63, 0xd6, 0x3a, 0x97, 0x09, 0xee, 0xde, 0x42, 0x64, 0x7c, 0xea, 0x56, 0x14, 0x93,
+ 0xd5, 0x45, 0x70, 0xa8, 0x79, 0xc1, 0x86, 0x82, 0xcd, 0x97, 0x71, 0x0b, 0x96, 0x20, 0x5e, 0xc3,
+ 0x11, 0x17, 0xd7, 0x3b, 0x5f, 0x36, 0x22, 0x3f, 0xad, 0xd6, 0xe8, 0xba, 0x90, 0xdd, 0x7c, 0x0e,
+ 0xe6, 0x1d, 0x44, 0xe1, 0x63, 0x25, 0x1e, 0x20, 0xc7, 0xf6, 0x6e, 0xb3, 0x05, 0x11, 0x7c, 0xb8,
+};
+
+static const uint8_t ac_rsaes_oaep_vect10_ptx[] = {
+ 0x8b, 0xba, 0x6b, 0xf8, 0x2a, 0x6c, 0x0f, 0x86, 0xd5, 0xf1, 0x75, 0x6e, 0x97, 0x95, 0x68, 0x70,
+ 0xb0, 0x89, 0x53, 0xb0, 0x6b, 0x4e, 0xb2, 0x05, 0xbc, 0x16, 0x94, 0xee,
+};
+
+static const uint8_t ac_rsaes_oaep_vect10_out[] = {
+ 0x53, 0xea, 0x5d, 0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0xd3, 0x2f, 0x21, 0x3d, 0xd4, 0x5c, 0x62, 0x73, 0xd5, 0x05,
+ 0xad, 0xf4, 0xcc, 0xed, 0x10, 0x57, 0xcb, 0x75, 0x8f, 0xc2, 0x6a, 0xee, 0xfa, 0x44, 0x12, 0x55,
+ 0xed, 0x4e, 0x64, 0xc1, 0x99, 0xee, 0x07, 0x5e, 0x7f, 0x16, 0x64, 0x61, 0x82, 0xfd, 0xb4, 0x64,
+ 0x73, 0x9b, 0x68, 0xab, 0x5d, 0xaf, 0xf0, 0xe6, 0x3e, 0x95, 0x52, 0x01, 0x68, 0x24, 0xf0, 0x54,
+ 0xbf, 0x4d, 0x3c, 0x8c, 0x90, 0xa9, 0x7b, 0xb6, 0xb6, 0x55, 0x32, 0x84, 0xeb, 0x42, 0x9f, 0xcc,
+};
+
+/* diffie hellman test data */
+/* p and g testdata generated using the following line:
+ * for i in {256..2048..64}; do openssl dhparam -C -5 $i; done
+ */
+static const uint8_t keygen_dh256_p[] = {
+ 0xB6, 0x73, 0x91, 0xB5, 0xD6, 0xBC, 0x95, 0x73, 0x0D, 0x53, 0x64, 0x13,
+ 0xB0, 0x51, 0xC6, 0xB4, 0xEB, 0x9D, 0x74, 0x57, 0x8D, 0x65, 0x3A, 0x4B,
+ 0x7A, 0xB2, 0x93, 0x27, 0xA6, 0xC1, 0xBC, 0xAB,
+};
+
+static const uint8_t keygen_dh256_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh320_p[] = {
+ 0x80, 0x72, 0x50, 0x4F, 0x85, 0xD2, 0x32, 0x70, 0xA3, 0x11, 0xF4, 0x46,
+ 0x01, 0x72, 0xD0, 0x72, 0x96, 0xA5, 0x1B, 0xFA, 0x8F, 0x35, 0x49, 0x75,
+ 0x04, 0xA5, 0x5A, 0x62, 0xB6, 0x33, 0xD6, 0x3C, 0x46, 0xD1, 0xED, 0xD7,
+ 0xB1, 0xD4, 0xBA, 0xF3,
+};
+
+static const uint8_t keygen_dh320_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh384_p[] = {
+ 0xC2, 0x04, 0xC8, 0x0E, 0xE8, 0x3F, 0x02, 0x1F, 0xDE, 0x0C, 0xAA, 0x2E,
+ 0x67, 0x13, 0xF4, 0x33, 0x67, 0x82, 0x59, 0xE7, 0x80, 0xE5, 0x42, 0xEA,
+ 0x2F, 0xC4, 0x71, 0x93, 0xA7, 0x1C, 0x86, 0xEC, 0x8C, 0x39, 0xF8, 0xC7,
+ 0xF1, 0xE3, 0xE0, 0xEE, 0xC4, 0x55, 0xF5, 0x4F, 0xE7, 0x98, 0xF0, 0x47,
+};
+
+static const uint8_t keygen_dh384_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh448_p[] = {
+ 0x91, 0xB9, 0x28, 0x8F, 0x01, 0x62, 0xA1, 0x40, 0x4D, 0x53, 0xC7, 0xD5,
+ 0xEE, 0x97, 0x40, 0x03, 0x39, 0x39, 0x41, 0x5F, 0x17, 0x0F, 0xA2, 0x78,
+ 0xBF, 0x3D, 0x6B, 0x33, 0x33, 0x39, 0x3B, 0x57, 0x21, 0x5B, 0xF9, 0xB1,
+ 0x6C, 0xE3, 0xB8, 0x19, 0xBE, 0x81, 0xBD, 0xC4, 0xFF, 0x4C, 0xFA, 0x48,
+ 0x63, 0x24, 0x10, 0x33, 0xDE, 0x3A, 0xFD, 0x3B,
+};
+
+static const uint8_t keygen_dh448_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh512_p[] = {
+ 0xCF, 0x09, 0xB8, 0xCD, 0x0B, 0xC5, 0x9D, 0xBD, 0x7A, 0x34, 0x50, 0x55,
+ 0xEC, 0xD4, 0xED, 0x92, 0x9D, 0x63, 0x92, 0xF9, 0x1D, 0x42, 0xF3, 0x64,
+ 0x04, 0x3D, 0xCC, 0xAA, 0x5F, 0xD1, 0xBB, 0xEA, 0x44, 0x12, 0xFC, 0xF0,
+ 0xFB, 0xFF, 0x26, 0x57, 0xE3, 0x6E, 0xA8, 0x3F, 0x45, 0x43, 0x11, 0x81,
+ 0xC6, 0x79, 0xF0, 0x0B, 0x11, 0x23, 0x1D, 0x7B, 0x1E, 0x59, 0xA8, 0xB8,
+ 0x69, 0x44, 0xA7, 0xE3,
+};
+
+static const uint8_t keygen_dh512_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh576_p[] = {
+ 0xEF, 0xA2, 0xD7, 0x81, 0x88, 0xAA, 0xBF, 0x70, 0x03, 0x70, 0xD4, 0x75,
+ 0xA6, 0x3E, 0x5B, 0xCF, 0x73, 0xDE, 0x7D, 0x45, 0x67, 0x47, 0xB1, 0xCF,
+ 0xA8, 0x62, 0xA9, 0x13, 0x9F, 0xC3, 0x9B, 0x96, 0xCE, 0xB9, 0x0C, 0x24,
+ 0xAC, 0xCB, 0xB6, 0x40, 0x30, 0x25, 0x26, 0x4E, 0x9D, 0x50, 0xA7, 0x8F,
+ 0x09, 0x1C, 0x9B, 0xDE, 0x77, 0x8A, 0xE8, 0xAA, 0xDA, 0xC2, 0x31, 0x08,
+ 0x55, 0x2C, 0xC1, 0x13, 0x24, 0x6E, 0x5A, 0xE7, 0xA1, 0xBC, 0xE5, 0x5B,
+};
+
+static const uint8_t keygen_dh576_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh640_p[] = {
+ 0xED, 0xB6, 0x90, 0x9C, 0x72, 0x5C, 0x63, 0x11, 0x17, 0xA9, 0xB6, 0x0E,
+ 0x6C, 0x80, 0xA9, 0xF3, 0x15, 0x36, 0x9D, 0x49, 0x02, 0x2B, 0x4F, 0x12,
+ 0x1A, 0xFD, 0x00, 0xC0, 0x9B, 0x12, 0x10, 0x96, 0x18, 0x55, 0x3F, 0x0C,
+ 0x75, 0x46, 0x6E, 0xDF, 0x0A, 0x58, 0x8E, 0x1B, 0x4B, 0xFF, 0x24, 0x70,
+ 0xFC, 0x29, 0xE8, 0x67, 0x8F, 0x0B, 0x72, 0x14, 0x80, 0x6F, 0xE9, 0xCD,
+ 0x30, 0x3C, 0x16, 0xB9, 0xB0, 0x32, 0xBE, 0x6A, 0x1D, 0x06, 0xEE, 0x6D,
+ 0x15, 0x44, 0x49, 0x55, 0xA8, 0x08, 0x2D, 0x0F,
+};
+
+static const uint8_t keygen_dh640_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh704_p[] = {
+ 0xA6, 0xBF, 0xA1, 0x02, 0x02, 0xA7, 0x7A, 0x6E, 0xFC, 0x48, 0x55, 0x81,
+ 0x23, 0x3F, 0x08, 0x8E, 0x83, 0xE9, 0x10, 0x92, 0x96, 0x82, 0x5F, 0xB8,
+ 0x88, 0x28, 0x0C, 0x6A, 0x04, 0x41, 0xEF, 0x4C, 0xCC, 0x2F, 0x16, 0xCD,
+ 0xA4, 0x2F, 0x24, 0x3B, 0xB6, 0x8A, 0x45, 0x76, 0xB3, 0xFA, 0x23, 0x83,
+ 0x53, 0xB2, 0x8F, 0x0C, 0xAE, 0xF9, 0xE8, 0xDB, 0x46, 0x5B, 0xBF, 0x7E,
+ 0xC3, 0x6F, 0x4F, 0xE6, 0xE7, 0x51, 0x75, 0x49, 0xB5, 0x4B, 0xBE, 0x48,
+ 0x51, 0x64, 0x9F, 0x5D, 0x56, 0xC7, 0x28, 0x9C, 0xC5, 0xBD, 0x0C, 0xD2,
+ 0x3A, 0x63, 0x49, 0x57,
+};
+
+static const uint8_t keygen_dh704_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh768_p[] = {
+ 0xEA, 0x9B, 0x0E, 0xD5, 0xDF, 0xC6, 0x9C, 0x8A, 0x26, 0x29, 0xD4, 0x2A,
+ 0x94, 0x4F, 0xD5, 0x3E, 0xEA, 0xEC, 0xCD, 0x89, 0xDA, 0x9C, 0x12, 0x52,
+ 0x94, 0xA7, 0x1A, 0x7D, 0x14, 0x94, 0xB1, 0x89, 0x79, 0xF3, 0x4A, 0xC3,
+ 0xD6, 0xF5, 0x52, 0xA6, 0x65, 0xC6, 0x0C, 0xD2, 0x2B, 0x16, 0xCB, 0x4F,
+ 0x69, 0x4C, 0x41, 0x6C, 0xA6, 0xAF, 0xCE, 0xFD, 0x50, 0x0E, 0x8C, 0x9E,
+ 0xA7, 0x19, 0x46, 0x6E, 0xC2, 0x27, 0xB9, 0xAF, 0x61, 0x4B, 0xDA, 0x3A,
+ 0x60, 0xBA, 0x6D, 0xCE, 0xBA, 0x39, 0x1C, 0x02, 0xBF, 0x09, 0xF0, 0xF9,
+ 0x87, 0xBE, 0xA1, 0xDE, 0x4E, 0x34, 0x7B, 0x28, 0x3A, 0xC2, 0x9E, 0x83,
+};
+
+static const uint8_t keygen_dh768_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh832_p[] = {
+ 0xB9, 0x0C, 0x79, 0x82, 0x7B, 0x23, 0xB7, 0x2F, 0x5A, 0x7B, 0xB1, 0xB9,
+ 0x63, 0x30, 0x7C, 0xD4, 0x0B, 0xEB, 0x7B, 0x8A, 0x67, 0x3E, 0x3B, 0x67,
+ 0xF1, 0x72, 0x90, 0x0E, 0xBF, 0x67, 0xEF, 0xBB, 0x95, 0xC1, 0x47, 0xED,
+ 0x89, 0x11, 0x79, 0x40, 0x63, 0x02, 0xF0, 0x41, 0x0C, 0xD1, 0x76, 0x15,
+ 0xAA, 0x24, 0x6A, 0xAE, 0x98, 0xFB, 0x19, 0x1F, 0x43, 0xB9, 0x92, 0xC7,
+ 0xB6, 0x33, 0xD8, 0x85, 0xBD, 0x06, 0x7D, 0x68, 0x32, 0xEE, 0xDB, 0x41,
+ 0xEF, 0x7B, 0xBD, 0xB4, 0xFE, 0x53, 0x4F, 0x6C, 0xA8, 0x26, 0xE0, 0x62,
+ 0x7D, 0x06, 0x06, 0xC5, 0xFB, 0x47, 0xD0, 0x3F, 0x4B, 0xC1, 0x7A, 0xC4,
+ 0x2A, 0xF3, 0x69, 0xF2, 0xDE, 0x77, 0xCD, 0x03,
+};
+
+static const uint8_t keygen_dh832_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh896_p[]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 0x2F, 0xF6,
+ 0xA8, 0xB1, 0x01, 0x53,
+};
+
+static const uint8_t keygen_dh1088_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh1152_p[] = {
+ 0xCA, 0xD6, 0x34, 0x4F, 0xAE, 0x99, 0x47, 0x51, 0x14, 0x5D, 0xF4, 0xCA,
+ 0x47, 0xE2, 0xE7, 0x62, 0x7D, 0xB9, 0xC9, 0xE7, 0xF7, 0xEE, 0xD4, 0xF0,
+ 0x04, 0xC1, 0x93, 0x06, 0xC2, 0xC8, 0x5E, 0x9D, 0xD3, 0x9F, 0x4A, 0x87,
+ 0xF2, 0x22, 0x5A, 0x72, 0x8D, 0xEB, 0x8B, 0x12, 0x26, 0x82, 0x3A, 0xA7,
+ 0x6B, 0xE1, 0x55, 0xB0, 0x9F, 0x97, 0x4C, 0xC5, 0xEC, 0x5C, 0x1C, 0x23,
+ 0xAB, 0x95, 0xDC, 0x17, 0xD5, 0x80, 0x0A, 0xE6, 0x53, 0x9E, 0xD8, 0xC6,
+ 0xB9, 0x9E, 0xFA, 0x62, 0x60, 0x2A, 0x8D, 0xD5, 0x3D, 0x36, 0x5E, 0x4E,
+ 0x42, 0x1F, 0xAF, 0x2B, 0x87, 0x0E, 0xC6, 0x44, 0xB7, 0x55, 0x1C, 0x81,
+ 0x7E, 0x48, 0x96, 0x1B, 0xF9, 0x73, 0x1C, 0x3D, 0x80, 0xDF, 0x43, 0xDB,
+ 0x93, 0xB6, 0x1E, 0xC1, 0x04, 0x12, 0x9E, 0x33, 0x21, 0xCE, 0xF7, 0x49,
+ 0x41, 0x7E, 0x97, 0x31, 0xC3, 0x74, 0x1D, 0x95, 0x85, 0x6F, 0x3A, 0xA1,
+ 0xCF, 0x61, 0xD9, 0xEB, 0x67, 0x67, 0xED, 0x91, 0xDF, 0x23, 0xCD, 0xC3,
+};
+
+static const uint8_t keygen_dh1152_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh1216_p[] = {
+ 0xB1, 0xF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, 0x52, 0x35, 0x5C, 0x3D, 0xD3, 0x97, 0x61, 0x58,
+ 0x69, 0x1B, 0x4F, 0x9C, 0xF9, 0xC9, 0x34, 0xDA, 0x9B, 0x8B, 0x04, 0x18,
+ 0x12, 0x2F, 0xF1, 0x22, 0x78, 0x0F, 0xD3, 0xAA, 0x85, 0x06, 0xA9, 0xCA,
+ 0x9E, 0x80, 0x39, 0x25, 0x12, 0x41, 0xDD, 0x86, 0x58, 0x1F, 0x4D, 0x1F,
+ 0x9B, 0xDB, 0x63, 0xD0, 0x80, 0x5E, 0x53, 0xAC, 0x86, 0x0C, 0x1E, 0x11,
+ 0xB1, 0x0D, 0xB6, 0x1F, 0xFE, 0x7C, 0x23, 0x6A, 0x71, 0x47, 0xA5, 0xC2,
+ 0x20, 0x23, 0x9F, 0x1D, 0xDF, 0xB9, 0x91, 0x4B,
+};
+
+static const uint8_t keygen_dh1600_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh1664_p[] = {
+ 0xAB, 0xF8, 0x74, 0x92, 0xCE, 0x1A, 0x3F, 0x89, 0xE1, 0xB7, 0x75, 0x5E,
+ 0x99, 0xBE, 0xFF, 0x73, 0x3E, 0x78, 0x86, 0xB0, 0x5E, 0x2F, 0x5C, 0xA4,
+ 0xB2, 0xE4, 0x72, 0x2C, 0x59, 0xB6, 0x64, 0x6F, 0x63, 0x72, 0xE3, 0x82,
+ 0xA4, 0xFB, 0x03, 0x57, 0x40, 0x6D, 0x6B, 0x1E, 0x2B, 0xB9, 0x8C, 0xB0,
+ 0x19, 0xB0, 0xE8, 0xC3, 0x3D, 0xEC, 0xC2, 0xA0, 0x91, 0x15, 0x02, 0x79,
+ 0x93, 0x31, 0xE4, 0x3A, 0x17, 0x9D, 0x9F, 0x68, 0xCD, 0x73, 0x28, 0x83,
+ 0xC3, 0x07, 0x43, 0x15, 0x05, 0x50, 0x9F, 0x78, 0x91, 0x2A, 0x98, 0x35,
+ 0xA3, 0xE4, 0x84, 0x84, 0x55,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, 0x0D, 0xBA, 0xBC, 0x06, 0x22, 0x59, 0x83, 0x93, 0xF6, 0x4B,
+ 0xBC, 0x35, 0xAD, 0x48, 0x82, 0x40, 0x55, 0x51, 0xBC, 0xF8, 0xE2, 0x9A,
+ 0x11, 0xF2, 0x08, 0x1E, 0xCA, 0x55, 0x40, 0x36, 0x00, 0xBE, 0x1C, 0xC8,
+ 0x94, 0x2E, 0x35, 0x7D, 0xB0, 0xA4, 0xCD, 0x1C, 0xC1, 0xFF, 0x58, 0xE1,
+ 0xBB, 0x31, 0xE9, 0x13, 0x16, 0x7F, 0x43, 0x88, 0xB2, 0x43, 0x62, 0x2A,
+ 0x79, 0xE3, 0x61, 0xDF, 0xF5, 0xC9, 0x9C, 0x33, 0xDD, 0x93, 0x58, 0xFC,
+ 0x08, 0x51, 0xE8, 0xA8, 0x30, 0x61, 0x64, 0x83, 0xB3, 0x20, 0xC4, 0x53,
+ 0x95, 0xD6, 0xB3, 0x74, 0xB5, 0xFA, 0xB1, 0x65, 0xD1, 0xF9, 0xED, 0xB1,
+ 0x9B, 0x97, 0x86, 0xC6, 0xDE, 0x6E, 0x5F, 0xF4, 0x6A, 0x42, 0xFA, 0x1F,
+ 0x6E, 0xEA, 0x5B, 0x43, 0x4C, 0xCC, 0x62, 0x76, 0xFE, 0x9B, 0xA0, 0xB9,
+ 0x7C, 0x50, 0x5E, 0x8B,
+};
+
+static const uint8_t keygen_dh1856_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh1920_p[] = {
+ 0xC2, 0x68, 0xB1, 0x2E, 0x41, 0xB7, 0xA3, 0xCC, 0xE8, 0x10, 0x48, 0xE8,
+ 0x80, 0xA5, 0x56, 0x82, 0x3C, 0x05, 0xA3, 0xC4, 0x20, 0xD5, 0xD7, 0x19,
+ 0x54, 0x60, 0xA4, 0x97, 0x95, 0x09, 0x3D, 0xDF, 0x10, 0xFF, 0x21, 0x0D,
+ 0x68, 0x19, 0x15, 0x89, 0xD1, 0x44, 0x14, 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x1E, 0x00, 0x51, 0x80, 0xE3, 0xED, 0x7A, 0xC0,
+ 0x4F, 0x80, 0xFA, 0x5F, 0xD5, 0xD7, 0x4F, 0xA7, 0x14, 0xE1, 0x60, 0x3C,
+ 0x95, 0x77, 0xCA, 0x3B,
+};
+
+static const uint8_t keygen_dh2048_g[] = {
+ 0x05,
+};
+
+static const uint8_t keygen_dh2048_subprime_p[] = {
+ 0x8F, 0x3E, 0xC1, 0x36, 0xCA, 0x60, 0xCE, 0xD1, 0xC5, 0xFD, 0x22, 0x05,
+ 0xD6, 0x94, 0x38, 0x20, 0x4F, 0xE1, 0xAF, 0xBC, 0xA6, 0x82, 0xBD, 0x71,
+ 0xFD, 0xD6, 0xC2, 0x61, 0xE8, 0xC1, 0xBD, 0xA9, 0x5E, 0xFD, 0x02, 0x51,
+ 0xB6, 0x1F, 0x38, 0x30, 0x44, 0x76, 0x94, 0xB3, 0x26, 0x79, 0x35, 0xC4,
+ 0xDF, 0x51, 0x80, 0xAF, 0x0D, 0x81, 0xCC, 0xA2, 0x33, 0xD1, 0x1E, 0x77,
+ 0xB8, 0x06, 0xD7, 0xE5, 0x83, 0x34, 0x04, 0xF2, 0x96, 0x24, 0x37, 0xFE,
+ 0xBC, 0x20, 0x9C, 0x66, 0x4C, 0xEB, 0x4F, 0xFD, 0x1F, 0x99, 0x56, 0x40,
+ 0xD9, 0xE8, 0x6B, 0x2A, 0x8D, 0x6B, 0x56, 0xB2, 0xB4, 0x6D, 0x83, 0x47,
+ 0x4C, 0x18, 0x53, 0x8B, 0xB1, 0xA3, 0x51, 0xC2, 0x07, 0xA3, 0x36, 0x43,
+ 0x4B, 0x94, 0x10, 0xFD, 0x24, 0xA3, 0x77, 0x74, 0x77, 0xFA, 0x98, 0x4B,
+ 0x43, 0x0B, 0xB6, 0xEC, 0x7F, 0x5C, 0x7E, 0xBA, 0xB7, 0xC7, 0xAA, 0x72,
+ 0x11, 0x9F, 0x73, 0x14, 0x45, 0x03, 0x7A, 0x4E, 0xE5, 0xE7, 0x5C, 0x64,
+ 0xB8, 0x66, 0x66, 0xCE, 0xEE, 0xF8, 0xFF, 0x61, 0x0F, 0x5D, 0x4E, 0xF6,
+ 0xED, 0xB1, 0xE5, 0x2F, 0x52, 0xAC, 0x2B, 0x8F, 0x34, 0x0D, 0x13, 0xF6,
+ 0x4A, 0x3A, 0x6C, 0x56, 0xB3, 0x3C, 0x52, 0xA8, 0xB9, 0xBC, 0x27, 0xCA,
+ 0x3B, 0xFB, 0x6E, 0xE7, 0x52, 0xFB, 0xB0, 0x2B, 0x4F, 0xC4, 0xBD, 0x24,
+ 0x36, 0xE4, 0x71, 0x07, 0x74, 0x69, 0x5F, 0xE0, 0xB8, 0x59, 0x5F, 0x74,
+ 0x2F, 0xCC, 0x03, 0xB0, 0x6D, 0x90, 0xD8, 0xD3, 0x7C, 0x5A, 0x31, 0x46,
+ 0x5C, 0x7D, 0x1C, 0xC8, 0x0D, 0x18, 0x80, 0x8E, 0x5A, 0xA8, 0x5E, 0x4D,
+ 0x11, 0x2B, 0x76, 0xAC, 0x1E, 0x00, 0x51, 0x80, 0xE3, 0xED, 0x7A, 0xC0,
+ 0x4F, 0x80, 0xFA, 0x5F, 0xD5, 0xD7, 0x4F, 0xA7, 0x14, 0xE1, 0x60, 0x3C,
+ 0x95, 0x77, 0xCA, 0x3B,
+};
+
+static const uint8_t keygen_dh2048_subprime_g[] = {
+ 0x05,
+};
+static const uint32_t keygen_dh256_private_bits;
+
+static const uint32_t keygen_dh320_private_bits = 256;
+
+static const uint32_t keygen_dh384_private_bits;
+
+static const uint32_t keygen_dh448_private_bits = 256;
+
+static const uint32_t keygen_dh512_private_bits;
+
+static const uint32_t keygen_dh576_private_bits = 288;
+
+static const uint32_t keygen_dh640_private_bits;
+
+static const uint32_t keygen_dh704_private_bits = 352;
+
+static const uint32_t keygen_dh768_private_bits;
+
+static const uint32_t keygen_dh832_private_bits = 416;
+
+static const uint32_t keygen_dh896_private_bits;
+
+static const uint32_t keygen_dh960_private_bits = 480;
+
+static const uint32_t keygen_dh1024_private_bits;
+
+static const uint32_t keygen_dh1088_private_bits = 544;
+
+static const uint32_t keygen_dh1152_private_bits;
+
+static const uint32_t keygen_dh1216_private_bits = 608;
+
+static const uint32_t keygen_dh1280_private_bits;
+
+static const uint32_t keygen_dh1344_private_bits = 672;
+
+static const uint32_t keygen_dh1408_private_bits;
+
+static const uint32_t keygen_dh1472_private_bits = 736;
+
+static const uint32_t keygen_dh1536_private_bits;
+
+static const uint32_t keygen_dh1600_private_bits = 800;
+
+static const uint32_t keygen_dh1664_private_bits;
+
+static const uint32_t keygen_dh1728_private_bits = 864;
+
+static const uint32_t keygen_dh1792_private_bits;
+
+static const uint32_t keygen_dh1856_private_bits = 928;
+
+static const uint32_t keygen_dh1920_private_bits;
+
+static const uint32_t keygen_dh1984_private_bits = 992;
+
+static const uint32_t keygen_dh2048_private_bits;
+
+static const uint32_t keygen_dh2048_subprime_private_bits;
+
+static const uint8_t keygen_dh2048_subprime_subprime[] = {
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/*
+ * Test data from 186-3dsatestvectors.zip KeyPair.rsp
+ * http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip
+ */
+/* [mod = L=1024, N=160] */
+static const uint8_t keygen_dsa_test1_p[] = {
+ 0xd3, 0x83, 0x11, 0xe2, 0xcd, 0x38, 0x8c, 0x3e, 0xd6, 0x98, 0xe8, 0x2f,
+ 0xdf, 0x88, 0xeb, 0x92, 0xb5, 0xa9, 0xa4, 0x83, 0xdc, 0x88, 0x00, 0x5d,
+ 0x4b, 0x72, 0x5e, 0xf3, 0x41, 0xea, 0xbb, 0x47, 0xcf, 0x8a, 0x7a, 0x8a,
+ 0x41, 0xe7, 0x92, 0xa1, 0x56, 0xb7, 0xce, 0x97, 0x20, 0x6c, 0x4f, 0x9c,
+ 0x5c, 0xe6, 0xfc, 0x5a, 0xe7, 0x91, 0x21, 0x02, 0xb6, 0xb5, 0x02, 0xe5,
+ 0x90, 0x50, 0xb5, 0xb2, 0x1c, 0xe2, 0x63, 0xdd, 0xdb, 0x20, 0x44, 0xb6,
+ 0x52, 0x23, 0x6f, 0x4d, 0x42, 0xab, 0x4b, 0x5d, 0x6a, 0xa7, 0x31, 0x89,
+ 0xce, 0xf1, 0xac, 0xe7, 0x78, 0xd7, 0x84, 0x5a, 0x5c, 0x1c, 0x1c, 0x71,
+ 0x47, 0x12, 0x31, 0x88, 0xf8, 0xdc, 0x55, 0x10, 0x54, 0xee, 0x16, 0x2b,
+ 0x63, 0x4d, 0x60, 0xf0, 0x97, 0xf7, 0x19, 0x07, 0x66, 0x40, 0xe2, 0x09,
+ 0x80, 0xa0, 0x09, 0x31, 0x13, 0xa8, 0xbd, 0x73
+};
+
+static const uint8_t keygen_dsa_test1_q[] = {
+ 0x96, 0xc5, 0x39, 0x0a, 0x8b, 0x61, 0x2c, 0x0e, 0x42, 0x2b, 0xb2, 0xb0,
+ 0xea, 0x19, 0x4a, 0x3e, 0xc9, 0x35, 0xa2, 0x81
+};
+
+static const uint8_t keygen_dsa_test1_g[] = {
+ 0x06, 0xb7, 0x86, 0x1a, 0xbb, 0xd3, 0x5c, 0xc8, 0x9e, 0x79, 0xc5, 0x2f,
+ 0x68, 0xd2, 0x08, 0x75, 0x38, 0x9b, 0x12, 0x73, 0x61, 0xca, 0x66, 0x82,
+ 0x21, 0x38, 0xce, 0x49, 0x91, 0xd2, 0xb8, 0x62, 0x25, 0x9d, 0x6b, 0x45,
+ 0x48, 0xa6, 0x49, 0x5b, 0x19, 0x5a, 0xa0, 0xe0, 0xb6, 0x13, 0x7c, 0xa3,
+ 0x7e, 0xb2, 0x3b, 0x94, 0x07, 0x4d, 0x3c, 0x3d, 0x30, 0x00, 0x42, 0xbd,
+ 0xf1, 0x57, 0x62, 0x81, 0x2b, 0x63, 0x33, 0xef, 0x7b, 0x07, 0xce, 0xba,
+ 0x78, 0x60, 0x76, 0x10, 0xfc, 0xc9, 0xee, 0x68, 0x49, 0x1d, 0xbc, 0x1e,
+ 0x34, 0xcd, 0x12, 0x61, 0x54, 0x74, 0xe5, 0x2b, 0x18, 0xbc, 0x93, 0x4f,
+ 0xb0, 0x0c, 0x61, 0xd3, 0x9e, 0x7d, 0xa8, 0x90, 0x22, 0x91, 0xc4, 0x43,
+ 0x4a, 0x4e, 0x22, 0x24, 0xc3, 0xf4, 0xfd, 0x9f, 0x93, 0xcd, 0x6f, 0x4f,
+ 0x17, 0xfc, 0x07, 0x63, 0x41, 0xa7, 0xe7, 0xd9
+};
+
+/* for i in {512..1024..64}; do openssl dsaparam -C $i; done */
+static const uint8_t keygen_dsa512_p[] = {
+ 0xC8, 0x6B, 0xB7, 0x91, 0xD6, 0x63, 0xCE, 0xC0, 0xC6, 0xB8, 0xAC, 0x5B,
+ 0xEB, 0xA7, 0xEF, 0x17, 0xBE, 0x1A, 0x1A, 0x36, 0x6B, 0x38, 0x40, 0x0E,
+ 0x69, 0x13, 0x32, 0xD4, 0x4B, 0xBE, 0x00, 0xB5, 0x29, 0x7F, 0x6B, 0x87,
+ 0xAA, 0x1D, 0x98, 0x37, 0xD2, 0xAC, 0x62, 0x26, 0xD7, 0xFD, 0xE1, 0xC9,
+ 0x13, 0x4F, 0x2A, 0xF2, 0x82, 0xEC, 0xA8, 0x83, 0x6F, 0x29, 0xD3, 0xF5,
+ 0x16, 0xB9, 0x13, 0xCD,
+};
+
+static const uint8_t keygen_dsa512_q[] = {
+ 0x8D, 0xF9, 0x8B, 0x8A, 0xDA, 0x3B, 0x0B, 0x1C, 0xFA, 0x1C, 0xA7, 0xE8,
+ 0x9A, 0xA2, 0xD7, 0xC3, 0x2D, 0xD5, 0x9D, 0x1B,
+};
+
+static const uint8_t keygen_dsa512_g[] = {
+ 0xB3, 0xE2, 0xFD, 0x38, 0xE0, 0x9A, 0x21, 0x64, 0x8F, 0x6D, 0x7E, 0x4F,
+ 0xC2, 0x24, 0x18, 0x88, 0xEC, 0xA4, 0xCB, 0xB0, 0x5F, 0x43, 0xD8, 0x2B,
+ 0x5B, 0xDE, 0x01, 0xB4, 0xD2, 0x24, 0x1F, 0x80, 0xE7, 0xFC, 0xF3, 0x15,
+ 0xFA, 0x0C, 0x5B, 0x6F, 0x81, 0x55, 0x8C, 0x80, 0x36, 0xFB, 0x4D, 0xB5,
+ 0x8C, 0x5A, 0x26, 0xBE, 0xFB, 0x78, 0xEA, 0x62, 0x6A, 0x9D, 0x5E, 0xD0,
+ 0x21, 0x0C, 0xD9, 0x4E,
+};
+
+static const uint8_t keygen_dsa576_p[] = {
+ 0xF7, 0x85, 0x23, 0x2C, 0x2C, 0x86, 0xD4, 0x2B, 0xE5, 0x09, 0xAB, 0x60,
+ 0xD6, 0x79, 0x05, 0x13, 0x75, 0x78, 0x1E, 0xAE, 0xEB, 0x5F, 0xBA, 0xFA,
+ 0x6E, 0x05, 0xE7, 0xB3, 0x8D, 0x33, 0x4B, 0xE5, 0xB5, 0xAA, 0xD4, 0xE6,
+ 0xA3, 0x9B, 0xA2, 0xF5, 0x7B, 0xF6, 0x32, 0xE6, 0x31, 0x6F, 0x34, 0x46,
+ 0x16, 0xEA, 0xD8, 0x94, 0x79, 0xD7, 0x69, 0x23, 0xA4, 0x04, 0xE2, 0x25,
+ 0xBB, 0x6D, 0xCC, 0x6E, 0x99, 0xB7, 0x90, 0x90, 0x89, 0xB9, 0x88, 0x19,
+};
+
+static const uint8_t keygen_dsa576_q[] = {
+ 0xF0, 0xD8, 0x71, 0x31, 0xB5, 0x01, 0xC1, 0x6B, 0x09, 0xCE, 0x7D, 0x2F,
+ 0x82, 0x48, 0xB0, 0x21, 0x9C, 0xD6, 0xB5, 0xB1,
+};
+
+static const uint8_t keygen_dsa576_g[] = {
+ 0x33, 0x45, 0xB8, 0x9A, 0x17, 0x4B, 0xBF, 0xD3, 0xB2, 0xBA, 0xD2, 0xE4,
+ 0xAC, 0x54, 0xA0, 0x9B, 0x5F, 0x5D, 0x95, 0x88, 0x9C, 0x0C, 0x59, 0xCE,
+ 0x40, 0x0C, 0x05, 0xFD, 0xC4, 0x9D, 0x22, 0x27, 0xDA, 0xA6, 0xD1, 0x10,
+ 0x61, 0x46, 0x31, 0x5C, 0x7D, 0x4E, 0xF6, 0x01, 0x38, 0x9A, 0x7E, 0x72,
+ 0x4E, 0x7A, 0x07, 0xFB, 0x6D, 0x20, 0x9D, 0x59, 0xC6, 0x33, 0x6A, 0x64,
+ 0xBF, 0x14, 0x30, 0x4E, 0x0C, 0x64, 0x9D, 0x11, 0xCF, 0x64, 0xCE, 0x29,
+};
+
+static const uint8_t keygen_dsa640_p[] = {
+ 0x88, 0x8C, 0x58, 0x99, 0xF4, 0x78, 0xEA, 0x31, 0x56, 0xB7, 0x2C, 0x70,
+ 0xDC, 0x09, 0x5D, 0xB9, 0x13, 0x16, 0xCE, 0xDF, 0xFD, 0x8C, 0x4E, 0xF8,
+ 0x32, 0x59, 0x00, 0x58, 0xD6, 0x44, 0x4F, 0x95, 0xF7, 0x85, 0x14, 0xC3,
+ 0x10, 0x5A, 0xA2, 0x44, 0x2F, 0xA2, 0xC9, 0xB4, 0x88, 0x89, 0xA1, 0xAE,
+ 0x0E, 0x82, 0xE1, 0xC1, 0x45, 0x09, 0x98, 0xF7, 0xCB, 0xF2, 0xD8, 0xA0,
+ 0x6E, 0x32, 0x02, 0xE4, 0x0E, 0x7A, 0x43, 0x3A, 0xE1, 0x04, 0x4C, 0xC5,
+ 0x78, 0x0E, 0x02, 0x27, 0xC4, 0xD0, 0xCA, 0x29,
+};
+
+static const uint8_t keygen_dsa640_q[] = {
+ 0xD7, 0x63, 0x4F, 0x3E, 0x6D, 0x52, 0x93, 0x69, 0xFA, 0xFF, 0xDE,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D, 0x26, 0xCE, 0x4C, 0xE3, 0xBD, 0x73, 0xA3, 0xA6,
+ 0xA0, 0x12, 0xE1, 0xFD,
+};
+
+static const uint8_t keygen_dsa704_q[] = {
+ 0xCE, 0xB3, 0x2E, 0x41, 0xEB, 0xFD, 0x22, 0x2A, 0xCE, 0x9A, 0xAF, 0x24,
+ 0xE3, 0x02, 0x50, 0xDE, 0x47, 0xBC, 0x4C, 0x1F,
+};
+
+static const uint8_t keygen_dsa704_g[] = {
+ 0x08, 0x83, 0x72, 0x6D, 0x0A, 0x8F, 0x19, 0x61, 0xE4, 0x62, 0x40, 0x29,
+ 0x66, 0x6B, 0xDE, 0xBD, 0xAB, 0xE3, 0x5B, 0x58, 0x3F, 0xF5, 0xEA, 0xDE,
+ 0x8E, 0x7A, 0x34, 0xAF, 0x1C, 0x99, 0x03, 0x1A, 0x51, 0x17, 0xFC, 0xE0,
+ 0xA3, 0x22, 0x43, 0x63, 0xB6, 0x7E, 0x29, 0x4B, 0x23, 0x6C, 0xD1, 0xDE,
+ 0x59, 0xEC, 0x1D, 0x67, 0x94, 0xDD, 0x2E, 0x88, 0x86, 0xD3, 0xD6, 0x68,
+ 0x58, 0x36, 0x48, 0xF8, 0xEF, 0x38, 0x3F, 0xF5, 0x87, 0x96, 0x38, 0xD3,
+ 0x48, 0x50, 0x1F, 0xA3, 0x4A, 0xCA, 0xD7, 0x4D, 0xC3, 0x84, 0x83, 0xB1,
+ 0x8A, 0x95, 0xE0, 0xB3,
+};
+
+static const uint8_t keygen_dsa768_p[] = {
+ 0xF0, 0xB1, 0x93, 0xFD, 0x53, 0x98, 0x23, 0x43, 0xFB, 0x04, 0xB1, 0x31,
+ 0x80, 0x3D, 0xD3, 0x95, 0x56, 0x51, 0xCC, 0x32, 0xA4, 0x51, 0x00, 0x8A,
+ 0x80, 0xB6, 0x87, 0x70, 0xD7, 0x77, 0x8D, 0xA6, 0xC2, 0xB5, 0x85, 0xE1,
+ 0xE0, 0x9E, 0x11, 0x28, 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 0x78, 0x40, 0xED, 0x4C, 0x96, 0xB9,
+};
+
+static const uint8_t keygen_dsa832_p[] = {
+ 0x93, 0x47, 0x85, 0x69, 0x79, 0xF2, 0xAA, 0xC2, 0x83, 0xA4, 0x08, 0x2F,
+ 0x3C, 0xE5, 0x4D, 0x3B, 0xFF, 0x4D, 0xC5, 0xF4, 0x03, 0x20, 0xFA, 0x15,
+ 0xA8, 0x27, 0x80, 0x55, 0x29, 0x57, 0x60, 0x0B, 0x75, 0x01, 0x7B, 0x65,
+ 0xCE, 0x4D, 0x7C, 0xF6, 0x7C, 0x4F, 0x1D, 0xC3, 0x67, 0xF2, 0xC1, 0x64,
+ 0x38, 0x49, 0x54, 0x60, 0x57, 0x05, 0xEB, 0x31, 0xFA, 0x7B, 0x50, 0xA1,
+ 0x0F, 0xCB, 0xC4, 0x4E, 0xDF, 0x92, 0x5A, 0x8B, 0x11, 0xBA, 0x6B, 0x7E,
+ 0x7A, 0xB4, 0x80, 0xD0, 0x9A, 0xE2, 0x88, 0x7D, 0x83, 0xA6, 0x81, 0x81,
+ 0x71, 0xD0, 0x06, 0xDE, 0xCC, 0xA4, 0xB9, 0x0A, 0x6B, 0x81, 0x31, 0x28,
+ 0x1D, 0xEF, 0x5F, 0x99, 0xDE, 0xEC, 0xDA, 0x4D,
+};
+
+static const uint8_t keygen_dsa832_q[] = {
+ 0xF8, 0xF5, 0xAF, 0x31, 0x0D, 0xBE, 0x6F, 0x4B, 0x79, 0x87, 0xA2, 0x98,
+ 0xED, 0xF1, 0x2A, 0x93, 0x3D, 0x12, 0x5D, 0x25,
+};
+
+static const uint8_t keygen_dsa832_g[] = {
+ 0x11, 0x21, 0xBC, 0x83, 0x7A, 0xD9, 0x5F, 0x0E, 0xA2, 0xF7, 0x96, 0xB7,
+ 0x6A, 0xDD, 0xAE, 0xBA, 0x11, 0x26, 0x58, 0xF6, 0xB1, 0xCF, 0x94, 0x35,
+ 0x3B, 0xFB, 0x9C, 0x9B, 0x16, 0xB8, 0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0x31,
+ 0xAC, 0x25, 0xD3, 0x3C, 0x35, 0xAD, 0x36, 0x8D, 0x25, 0x41, 0xE9, 0x21,
+ 0xD1, 0xF9, 0xC3, 0xC9,
+};
+
+static const uint8_t keygen_dsa896_q[] = {
+ 0xAE, 0x42, 0x0A, 0x1D, 0x76, 0xA9, 0xFB, 0xF1, 0xCB, 0x2D, 0x73, 0x35,
+ 0x3F, 0x98, 0x63, 0x34, 0xE1, 0xCD, 0x3C, 0xCF,
+};
+
+static const uint8_t keygen_dsa896_g[] = {
+ 0x12, 0xD0, 0x15, 0x32, 0x0B, 0x7D, 0xE3, 0xD0, 0x36, 0x51, 0x79, 0x3E,
+ 0xB4, 0x4E, 0xE2, 0x1E, 0x5E, 0x3E, 0x43, 0x4C, 0x5D, 0x49, 0x9D, 0xD4,
+ 0xA3, 0xE3, 0xC8, 0x1F, 0x46, 0xA2, 0xCE, 0x95, 0xF9, 0x8D, 0xFC, 0xFD,
+ 0x50, 0x48, 0xBF, 0xB5, 0x25, 0xB6, 0xFD, 0xF9, 0xF1, 0x97, 0xD5, 0x82,
+ 0xEE, 0xE7, 0xDF, 0xC6, 0xDD, 0x09, 0x96, 0x15, 0xC0, 0x95, 0x60, 0xF4,
+ 0x53, 0xF6, 0x19, 0xA4, 0x84, 0x53, 0xE4, 0x87, 0xB6, 0x0C, 0x6C, 0x01,
+ 0x31, 0x72, 0x56, 0xA4, 0x2E, 0x25, 0xFC, 0x46, 0xB0, 0x47, 0xF3, 0x5A,
+ 0x90, 0x69, 0xAC, 0x64, 0x02, 0xCB, 0x1F, 0x5F, 0x10, 0x70, 0x2B, 0x71,
+ 0xF7, 0x9B, 0x70, 0x22, 0x7F, 0x05, 0xEB, 0xCB, 0x6D, 0x66, 0xDE, 0xFC,
+ 0xED, 0x51, 0xC2, 0x4D,
+};
+
+static const uint8_t keygen_dsa960_p[] = {
+ 0xCA, 0x86, 0x31, 0x0C, 0x62, 0xC7, 0x25, 0x2F, 0xAA, 0x8D, 0xA5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, 0x6E, 0x3F, 0x8E, 0x99, 0x31, 0xBA,
+ 0x1A, 0xB9, 0x8E, 0xEC, 0xA3, 0x13, 0xC2, 0x85, 0xA5, 0xDC, 0xA4, 0xF0,
+ 0x1F, 0xB2, 0xC8, 0xD5, 0x19, 0x79, 0xCA, 0x6A,
+};
+
+/* derive key test data, taken from GP test specifikation */
+static const uint8_t derive_key_dh_prime[] = {
+ 0xe0, 0x01, 0xe8, 0x96, 0x7d, 0xb4, 0x93, 0x53, 0xe1, 0x6f, 0x8e, 0x89,
+ 0x22, 0x0c, 0xce, 0xfc, 0x5c, 0x5f, 0x12, 0xe3, 0xdf, 0xf8, 0xf1, 0xd1,
+ 0x49, 0x90, 0x12, 0xe6, 0xef, 0x53, 0xe3, 0x1f, 0x02, 0xea, 0xcc, 0x5a,
+ 0xdd, 0xf3, 0x37, 0x89, 0x35, 0xc9, 0x5b, 0x21, 0xea, 0x3d, 0x6f, 0x1c,
+ 0xd7, 0xce, 0x63, 0x75, 0x52, 0xec, 0x38, 0x6c, 0x0e, 0x34, 0xf7, 0x36,
+ 0xad, 0x95, 0x17, 0xef, 0xfe, 0x5e, 0x4d, 0xa7, 0xa8, 0x6a, 0xf9, 0x0e,
+ 0x2c, 0x22, 0x8f, 0xe4, 0xb9, 0xe6, 0xd8, 0xf8, 0xf0, 0x2d, 0x20, 0xaf,
+ 0x78, 0xab, 0xb6, 0x92, 0xac, 0xbc, 0x4b, 0x23, 0xfa, 0xf2, 0xc5, 0xcc,
+ 0xd4, 0x9a, 0x0c, 0x9a, 0x8b, 0xcd, 0x91, 0xac, 0x0c, 0x55, 0x92, 0x01,
+ 0xe6, 0xc2, 0xfd, 0x1f, 0x47, 0xc2, 0xcb, 0x2a, 0x88, 0xa8, 0x3c, 0x21,
+ 0x0f, 0xc0, 0x54, 0xdb, 0x29, 0x2d, 0xbc, 0x45
+};
+
+static const uint8_t derive_key_dh_base[] = {
+ 0x1c, 0xe0, 0xf6, 0x69, 0x26, 0x46, 0x11, 0x97, 0xef, 0x45, 0xc4, 0x65,
+ 0x8b, 0x83, 0xb8, 0xab
+};
+
+static const uint8_t derive_key_dh_public_value[] = {
+ 0xbb, 0xe9, 0x18, 0xdd, 0x4b, 0x2b, 0x94, 0x1b, 0x10, 0x0e, 0x88, 0x35,
+ 0x28, 0x68, 0xfc, 0x62, 0x04, 0x38, 0xa6, 0xdb, 0x32, 0xa6, 0x9e, 0xee,
+ 0x6c, 0x6f, 0x45, 0x1c, 0xa3, 0xa6, 0xd5, 0x37, 0x77, 0x75, 0x5b, 0xc1,
+ 0x37, 0x0a, 0xce, 0xfe, 0x2b, 0x8f, 0x13, 0xa9, 0x14, 0x2c, 0x5b, 0x44,
+ 0x15, 0x78, 0x86, 0x30, 0xd6, 0x95, 0xb1, 0x92, 0x20, 0x63, 0xa3, 0xcf,
+ 0x9d, 0xef, 0x65, 0x61, 0x27, 0x4d, 0x24, 0x01, 0xe7, 0xa1, 0x45, 0xf2,
+ 0xd8, 0xb9, 0x3a, 0x45, 0x17, 0xf4, 0x19, 0xd0, 0x5e, 0xf8, 0xcb, 0x35,
+ 0x59, 0x37, 0x9d, 0x04, 0x20, 0xa3, 0xbf, 0x02, 0xad, 0xfe, 0xa8, 0x60,
+ 0xb2, 0xc3, 0xee, 0x85, 0x58, 0x90, 0xf3, 0xb5, 0x57, 0x2b, 0xb4, 0xef,
+ 0xd7, 0x8f, 0x37, 0x68, 0x78, 0x7c, 0x71, 0x52, 0x9d, 0x5e, 0x0a, 0x61,
+ 0x4f, 0x09, 0x89, 0x92, 0x39, 0xf7, 0x4b, 0x01
+};
+
+static const uint8_t derive_key_dh_private_value[] = {
+ 0x53, 0x8d, 0x3d, 0x64, 0x27, 0x4a, 0x40, 0x05, 0x9b, 0x9c, 0x26, 0xe9,
+ 0x13, 0xe6, 0x91, 0x53, 0x23, 0x7b, 0x55, 0x83
+};
+
+static const uint8_t derive_key_dh_public_value_2[] = {
+ 0xa3, 0xf5, 0x7d, 0xbe, 0x9e, 0x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, 0xce, 0x47, 0x2e, 0x21, 0x05, 0xe4, 0x9b, 0x3d, 0x7f, 0x11, 0x3b,
+ 0x82, 0x50, 0x76, 0xe6, 0x26, 0x45, 0x85, 0x80, 0x7b, 0xc4, 0x64, 0x54,
+ 0x66, 0x5f, 0x27, 0xc5, 0xe4, 0xe1, 0xa4, 0xbd, 0x03, 0x47, 0x04, 0x86,
+ 0x32, 0x29, 0x81, 0xfd, 0xc8, 0x94, 0xcc, 0xa1, 0xe2, 0x93, 0x09, 0x87,
+ 0xc9, 0x2c, 0x15, 0xa3, 0x8b, 0xc4, 0x2e, 0xb3, 0x88, 0x10, 0xe8, 0x67,
+ 0xc4, 0x43, 0x2f, 0x07, 0x25, 0x9e, 0xc0, 0x0c, 0xdb, 0xbb, 0x0f, 0xb9,
+ 0x9e, 0x17, 0x27, 0xc7, 0x06, 0xda, 0x58, 0xdd
+};
+
+static const uint32_t derive_key_max_keysize = 1024;
+
+
+#endif /*XTEST_4000_DATA_H*/
diff --git a/host/xtest/xtest_5000.c b/host/xtest/xtest_5000.c
new file mode 100644
index 0000000..88b9465
--- /dev/null
+++ b/host/xtest/xtest_5000.c
@@ -0,0 +1,572 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "xtest_test.h"
+#include "xtest_helpers.h"
+#include "tee_internal_api.h"
+#include "tee_api_defines.h"
+#include "tee_client_api.h"
+
+#define OFFSET0 0
+
+#define PARAM_0 0
+#define PARAM_1 1
+#define PARAM_2 2
+#define PARAM_3 3
+
+struct xtest_session {
+ ADBG_Case_t *c;
+ TEEC_Session session;
+ TEEC_Context context;
+};
+
+/* Compares two memories and checks if their length and content is the same */
+#define EXPECT_SHARED_MEM_BUFFER(c, exp_buf, exp_blen, op, param_num, shrm) \
+ do { \
+ if ((exp_buf) == NULL) { \
+ ADBG_EXPECT((c), exp_blen, \
+ (op)->params[(param_num)].memref.size); \
+ } else { \
+ ADBG_EXPECT_COMPARE_POINTER((c), (shrm), ==, \
+ (op)->params[(param_num)].memref.parent); \
+ ADBG_EXPECT_BUFFER((c), (exp_buf), (exp_blen), \
+ (shrm)->buffer, \
+ (op)->params[(param_num)].memref.size); \
+ } \
+ } while (0)
+
+/*
+ * Compares the content of the memory cells in OP with the expected value
+ * contained.
+ */
+#define EXPECT_OP_TMP_MEM_BUFFER(c, exp_buf, exp_blen, op, param_num, buf) \
+ do { \
+ if ((exp_buf) == NULL) { \
+ ADBG_EXPECT((c), exp_blen, \
+ (op)->params[(param_num)].tmpref.size); \
+ } else { \
+ ADBG_EXPECT_COMPARE_POINTER((c), (buf), ==, \
+ (op)->params[(param_num)].tmpref.buffer); \
+ ADBG_EXPECT_BUFFER((c), (exp_buf), (exp_blen), \
+ (buf), \
+ (op)->params[(param_num)].memref.size); \
+ } \
+ } while (0)
+
+/* Initiates the memory and allocates size uint32_t. */
+
+/* Registers the TEEC_SharedMemory to the TEE. */
+static TEEC_Result RegisterSharedMemory(TEEC_Context *ctx,
+ TEEC_SharedMemory *shm, uint32_t size,
+ uint32_t flags)
+{
+ shm->flags = flags;
+ shm->size = size;
+ return TEEC_RegisterSharedMemory(ctx, shm);
+}
+
+/* Allocates shared memory inside of the TEE. */
+static TEEC_Result AllocateSharedMemory(TEEC_Context *ctx,
+ TEEC_SharedMemory *shm, uint32_t size,
+ uint32_t flags)
+{
+ shm->flags = flags;
+ shm->size = size;
+ return TEEC_AllocateSharedMemory(ctx, shm);
+}
+
+static void CloseSession_null(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "CloseSession_null");
+ {
+ /* In reality doesn't test anything. */
+ TEEC_CloseSession(NULL);
+ }
+ Do_ADBG_EndSubCase(cs->c, "CloseSession_null");
+}
+
+static void Allocate_In(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Allocate_In");
+ {
+ TEEC_SharedMemory shm;
+ uint32_t size = 1024;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ AllocateSharedMemory(&cs->context, &shm, size,
+ TEEC_MEM_INPUT));
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Allocate_In");
+}
+
+static void Allocate_out_of_memory(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Allocate_out_of_memory");
+ {
+ TEEC_SharedMemory shm;
+ uint32_t SIZE_OVER_MEMORY_CAPACITY = INT32_MAX;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+ ADBG_EXPECT_TEEC_RESULT(cs->c, TEEC_ERROR_OUT_OF_MEMORY,
+ AllocateSharedMemory(&cs->context, &shm,
+ SIZE_OVER_MEMORY_CAPACITY,
+ TEEC_MEM_INPUT));
+ ADBG_EXPECT_POINTER(cs->c, NULL, shm.buffer);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Allocate_out_of_memory");
+}
+
+static void OpenSession_error_notExistingTA(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "OpenSession_error_notExistingTA");
+ {
+ TEEC_UUID NONEXISTING_TA_UUID = { 0x534D1192, 0x6143, 0x234C,
+ { 0x47, 0x55, 0x53, 0x52,
+ 0x54, 0x4F, 0x4F, 0x59 } };
+ uint32_t ret_orig;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ ADBG_EXPECT_COMPARE_UNSIGNED(cs->c, TEEC_SUCCESS, !=,
+ TEEC_OpenSession(&cs->context, &cs->session,
+ &NONEXISTING_TA_UUID,
+ TEEC_LOGIN_PUBLIC, NULL, NULL,
+ &ret_orig));
+ ADBG_EXPECT_COMPARE_UNSIGNED(cs->c, TEEC_ORIGIN_TRUSTED_APP, !=,
+ ret_orig);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "OpenSession_error_notExistingTA");
+}
+
+static void Allocate_InOut(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Allocate_InOut");
+ {
+ TEEC_SharedMemory shm;
+ uint8_t val[] = { 54, 76, 98, 32 };
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ AllocateSharedMemory(&cs->context, &shm, sizeof(val),
+ TEEC_MEM_INPUT | TEEC_MEM_OUTPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Allocate_InOut");
+}
+
+static void Register_In(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Register_In");
+ {
+ TEEC_SharedMemory shm;
+ uint8_t val[] = { 32, 65, 43, 21, 98 };
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ shm.buffer = val;
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ RegisterSharedMemory(&cs->context, &shm, sizeof(val),
+ TEEC_MEM_INPUT));
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Register_In");
+}
+
+static void Register_notZeroLength_Out(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Register_notZeroLength_Out");
+ {
+ TEEC_SharedMemory shm;
+ uint8_t val[] = { 56, 67, 78, 99 };
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ shm.buffer = val;
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c, RegisterSharedMemory(
+ &cs->context, &shm,
+ sizeof(val), TEEC_MEM_OUTPUT));
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Register_notZeroLength_Out");
+}
+
+static void Register_InOut(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Register_InOut");
+ {
+ TEEC_SharedMemory shm;
+ uint8_t val[] = { 54, 76, 23, 98, 255, 23, 86 };
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ shm.buffer = val;
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ RegisterSharedMemory(&cs->context, &shm, sizeof(val),
+ TEEC_MEM_INPUT | TEEC_MEM_OUTPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Register_InOut");
+}
+
+static void Register_zeroLength_Out(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Register_zeroLength_Out");
+ {
+ uint8_t val[] = { 65, 76, 98, 32 };
+ TEEC_SharedMemory shm;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ shm.buffer = val;
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c, RegisterSharedMemory(
+ &cs->context, &shm, 0,
+ TEEC_MEM_OUTPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Register_zeroLength_Out");
+}
+
+static void Allocate_Out(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Allocate_Out");
+ {
+ TEEC_SharedMemory shm;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ AllocateSharedMemory(&cs->context, &shm, 0,
+ TEEC_MEM_OUTPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Allocate_Out");
+}
+
+static void FinalizeContext_null(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "FinalizeContext_null");
+ {
+ TEEC_FinalizeContext(NULL);
+ }
+ Do_ADBG_EndSubCase(cs->c, "FinalizeContext_null");
+}
+
+static void InitializeContext_NotExistingTEE(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "InitializeContext_NotExistingTEE");
+ {
+ ADBG_EXPECT_COMPARE_UNSIGNED(cs->c, TEEC_SUCCESS, !=,
+ TEEC_InitializeContext("Invalid TEE name",
+ &cs->context));
+ }
+ Do_ADBG_EndSubCase(cs->c, "InitializeContext_NotExistingTEE");
+}
+
+static void AllocateThenRegister_SameMemory(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "AllocateThenRegister_SameMemory");
+ {
+ TEEC_SharedMemory shm;
+ uint32_t size_allocation = 32;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ AllocateSharedMemory(&cs->context, &shm,
+ size_allocation, TEEC_MEM_INPUT));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ RegisterSharedMemory(&cs->context, &shm,
+ size_allocation, TEEC_MEM_INPUT));
+ }
+ Do_ADBG_EndSubCase(cs->c, "AllocateThenRegister_SameMemory");
+}
+
+static void AllocateSameMemory_twice(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "AllocateSameMemory_twice");
+ {
+ TEEC_SharedMemory shm;
+ uint32_t size_allocation = 32;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ AllocateSharedMemory(&cs->context, &shm,
+ size_allocation, TEEC_MEM_INPUT));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ AllocateSharedMemory(&cs->context, &shm,
+ size_allocation, TEEC_MEM_INPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "AllocateSameMemory_twice");
+}
+
+static void RegisterSameMemory_twice(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "RegisterSameMemory_twice");
+ {
+ uint8_t val[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
+ TEEC_SharedMemory shm;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ shm.buffer = val;
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ RegisterSharedMemory(&cs->context, &shm, sizeof(val),
+ TEEC_MEM_INPUT));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ RegisterSharedMemory(&cs->context, &shm, sizeof(val),
+ TEEC_MEM_INPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "RegisterSameMemory_twice");
+}
+
+static void Allocate_sharedMemory_maxSize(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c,
+ "Allocate_sharedMemory_MaxSize_Above_and_Below, allocate max size");
+ {
+ uint32_t size_max = TEEC_CONFIG_SHAREDMEM_MAX_SIZE;
+ TEEC_SharedMemory shm;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ AllocateSharedMemory(&cs->context, &shm, size_max,
+ TEEC_MEM_INPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ }
+ Do_ADBG_EndSubCase(cs->c,
+ "Allocate_sharedMemory_MaxSize_Above_and_Below, allocate max size");
+}
+
+static void Allocate_sharedMemory_belowMaxSize(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c,
+ "Allocate_sharedMemory_MaxSize_Above_and_Below, "
+ "allocate just below max size");
+ {
+ TEEC_SharedMemory shm;
+ uint32_t size_below = TEEC_CONFIG_SHAREDMEM_MAX_SIZE - 1;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ AllocateSharedMemory(&cs->context, &shm, size_below,
+ TEEC_MEM_INPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c,
+ "Allocate_sharedMemory_MaxSize_Above_and_Below, "
+ "allocate just below max size");
+}
+
+static void Allocate_sharedMemory_aboveMaxSize(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c,
+ "Allocate_sharedMemory_MaxSize_Above_and_Below, "
+ "allocate just above max size");
+ {
+ TEEC_Result res;
+ TEEC_SharedMemory shm;
+ uint32_t size_above = TEEC_CONFIG_SHAREDMEM_MAX_SIZE + 1;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ res = AllocateSharedMemory(&cs->context, &shm, size_above,
+ TEEC_MEM_INPUT);
+
+ ADBG_EXPECT_TRUE(cs->c, res == TEEC_ERROR_OUT_OF_MEMORY ||
+ res == TEEC_SUCCESS);
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c,
+ "Allocate_sharedMemory_MaxSize_Above_and_Below, "
+ "allocate just above max size");
+}
+
+static void Register_sharedMemory_maxSize(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Register_sharedMemory_maxSize");
+ {
+ uint32_t size_max = TEEC_CONFIG_SHAREDMEM_MAX_SIZE;
+ uint8_t val[size_max];
+ TEEC_SharedMemory shm;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ shm.buffer = val;
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ RegisterSharedMemory(&cs->context, &shm, size_max,
+ TEEC_MEM_INPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ TEEC_FinalizeContext(&cs->context);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Register_sharedMemory_maxSize");
+}
+
+static void Register_sharedMemory_aboveMaxSize(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Register_sharedMemory_aboveMaxSize");
+ {
+ TEEC_Result res;
+ uint32_t size_aboveMax = 0xffffffff;
+ uint8_t val[1];
+ TEEC_SharedMemory shm;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ shm.buffer = val;
+ res = RegisterSharedMemory(&cs->context, &shm, size_aboveMax,
+ TEEC_MEM_INPUT);
+
+ ADBG_EXPECT_TRUE(cs->c, res == TEEC_ERROR_OUT_OF_MEMORY ||
+ res == TEEC_SUCCESS);
+
+ TEEC_ReleaseSharedMemory(&shm);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Register_sharedMemory_aboveMaxSize");
+}
+
+static void Register_sharedMemory_belowMaxSize(struct xtest_session *cs)
+{
+ Do_ADBG_BeginSubCase(cs->c, "Register_sharedMemory_belowMaxSize");
+ {
+ uint32_t size_belowMax = TEEC_CONFIG_SHAREDMEM_MAX_SIZE - 1;
+ uint8_t val[size_belowMax];
+ TEEC_SharedMemory shm;
+
+ ADBG_EXPECT(cs->c, TEEC_SUCCESS,
+ TEEC_InitializeContext(_device, &cs->context));
+
+ shm.buffer = val;
+ ADBG_EXPECT_TEEC_SUCCESS(cs->c,
+ RegisterSharedMemory(&cs->context, &shm, size_belowMax,
+ TEEC_MEM_INPUT));
+
+ TEEC_ReleaseSharedMemory(&shm);
+ }
+ Do_ADBG_EndSubCase(cs->c, "Register_sharedMemory_belowMaxSize");
+}
+
+static void xtest_teec_TEE(ADBG_Case_t *c)
+{
+ struct xtest_session connection = { c };
+
+ CloseSession_null(&connection);
+
+ Allocate_In(&connection);
+
+ Allocate_out_of_memory(&connection);
+
+ OpenSession_error_notExistingTA(&connection);
+
+ Allocate_InOut(&connection);
+
+ Register_In(&connection);
+
+ Register_notZeroLength_Out(&connection);
+
+ Register_InOut(&connection);
+
+ Register_zeroLength_Out(&connection);
+
+ Allocate_Out(&connection);
+
+ FinalizeContext_null(&connection);
+
+ InitializeContext_NotExistingTEE(&connection);
+
+ AllocateThenRegister_SameMemory(&connection);
+
+ AllocateSameMemory_twice(&connection);
+
+ RegisterSameMemory_twice(&connection);
+
+ Allocate_sharedMemory_maxSize(&connection);
+
+ Allocate_sharedMemory_belowMaxSize(&connection);
+
+ Allocate_sharedMemory_aboveMaxSize(&connection);
+
+ Register_sharedMemory_maxSize(&connection);
+
+ Register_sharedMemory_aboveMaxSize(&connection);
+
+ Register_sharedMemory_belowMaxSize(&connection);
+}
+
+ADBG_CASE_DEFINE(XTEST_TEE_5006, xtest_teec_TEE,
+ /* Title */
+ "Tests for Global platform TEEC",
+ /* Short description */
+ "Invocation of all tests for TEE Client API",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ...");
diff --git a/host/xtest/xtest_6000.c b/host/xtest/xtest_6000.c
new file mode 100644
index 0000000..ef607b5
--- /dev/null
+++ b/host/xtest/xtest_6000.c
@@ -0,0 +1,844 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include <adbg.h>
+#include <xtest_test.h>
+#include <xtest_helpers.h>
+
+#include <tee_client_api.h>
+#include <ta_storage.h>
+#include <tee_api_defines.h>
+#include <tee_api_types.h>
+
+static uint8_t file_00[] = {
+ 0x00, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
+ 0xF0, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
+ 0xE9, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
+ 0xF0, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x8E
+};
+
+static uint8_t file_01[] = {
+ 0x01, 0x00
+};
+
+static uint8_t file_02[] = {
+ 0x02, 0x11, 0x02
+};
+
+static uint8_t file_03[] = {
+ 0x03, 0x13, 0x03
+};
+
+static uint8_t data_00[] = {
+ 0x00, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
+ 0x00, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
+ 0x00, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
+ 0x00, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x00
+};
+
+static uint8_t data_01[] = {
+ 0x01, 0x6E, 0x04, 0x57, 0x08, 0xFB, 0x71, 0x96,
+ 0x01, 0x2E, 0x55, 0x3D, 0x02, 0xC3, 0xA6, 0x92,
+ 0x01, 0xC3, 0xEF, 0x8A, 0xB2, 0x34, 0x53, 0xE6,
+ 0x01, 0x74, 0x9C, 0xD6, 0x36, 0xE7, 0xA8, 0x01
+};
+
+static TEEC_Result fs_open(TEEC_Session *sess, void *id, uint32_t id_size,
+ uint32_t flags, uint32_t *obj)
+{
+ TEEC_Operation op;
+ TEEC_Result res;
+ uint32_t org;
+
+ op.params[0].tmpref.buffer = id;
+ op.params[0].tmpref.size = id_size;
+ op.params[1].value.a = flags;
+ op.params[1].value.b = 0;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
+ TEEC_VALUE_INOUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, TA_STORAGE_CMD_OPEN, &op, &org);
+
+ if (res == TEEC_SUCCESS)
+ *obj = op.params[1].value.b;
+
+ return res;
+}
+
+static TEEC_Result fs_create(TEEC_Session *sess, void *id, uint32_t id_size,
+ uint32_t flags, uint32_t attr, void *data,
+ uint32_t data_size, uint32_t *obj)
+{
+ TEEC_Operation op;
+ TEEC_Result res;
+ uint32_t org;
+
+ op.params[0].tmpref.buffer = id;
+ op.params[0].tmpref.size = id_size;
+ op.params[1].value.a = flags;
+ op.params[1].value.b = 0;
+ op.params[2].value.a = attr;
+ op.params[2].value.b = 0;
+ op.params[3].tmpref.buffer = data;
+ op.params[3].tmpref.size = data_size;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
+ TEEC_VALUE_INOUT, TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT);
+
+ res = TEEC_InvokeCommand(sess, TA_STORAGE_CMD_CREATE, &op, &org);
+
+ if (res == TEEC_SUCCESS)
+ *obj = op.params[1].value.b;
+
+ return res;
+}
+
+static TEEC_Result fs_close(TEEC_Session *sess, uint32_t obj)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.params[0].value.a = obj;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_CLOSE, &op, &org);
+}
+
+static TEEC_Result fs_read(TEEC_Session *sess, uint32_t obj, void *data,
+ uint32_t data_size, uint32_t *count)
+{
+ TEEC_Result res;
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.params[0].tmpref.buffer = data;
+ op.params[0].tmpref.size = data_size;
+ op.params[1].value.a = obj;
+ op.params[1].value.b = 0;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_VALUE_INOUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, TA_STORAGE_CMD_READ, &op, &org);
+
+ if (res == TEEC_SUCCESS)
+ *count = op.params[1].value.b;
+
+ return res;
+}
+
+static TEEC_Result fs_write(TEEC_Session *sess, uint32_t obj, void *data,
+ uint32_t data_size)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.params[0].tmpref.buffer = data;
+ op.params[0].tmpref.size = data_size;
+ op.params[1].value.a = obj;
+ op.params[1].value.b = 0;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_INPUT,
+ TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_WRITE, &op, &org);
+}
+
+static TEEC_Result fs_seek(TEEC_Session *sess, uint32_t obj, int32_t offset,
+ int32_t whence)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.params[0].value.a = obj;
+ op.params[0].value.b = offset;
+ op.params[1].value.a = whence;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_VALUE_INOUT,
+ TEEC_NONE, TEEC_NONE);
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_SEEK, &op, &org);
+}
+
+static TEEC_Result fs_unlink(TEEC_Session *sess, uint32_t obj)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.params[0].value.a = obj;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_UNLINK, &op, &org);
+}
+
+static TEEC_Result fs_trunc(TEEC_Session *sess, uint32_t obj, uint32_t len)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.params[0].value.a = obj;
+ op.params[0].value.b = len;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_TRUNC, &op, &org);
+}
+
+static TEEC_Result fs_rename(TEEC_Session *sess, uint32_t obj, void *id,
+ uint32_t id_size)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.params[0].value.a = obj;
+ op.params[1].tmpref.buffer = id;
+ op.params[1].tmpref.size = id_size;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_RENAME, &op, &org);
+}
+
+static TEEC_Result fs_alloc_enum(TEEC_Session *sess, uint32_t *e)
+{
+ TEEC_Result res;
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_OUTPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(sess, TA_STORAGE_CMD_ALLOC_ENUM, &op, &org);
+
+ if (res == TEEC_SUCCESS)
+ *e = op.params[0].value.a;
+
+ return res;
+}
+
+static TEEC_Result fs_free_enum(TEEC_Session *sess, uint32_t e)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
+ TEEC_NONE);
+
+ op.params[0].value.a = e;
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_FREE_ENUM, &op, &org);
+}
+
+static TEEC_Result fs_start_enum(TEEC_Session *sess, uint32_t e)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE,
+ TEEC_NONE, TEEC_NONE);
+
+ op.params[0].value.a = e;
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_START_ENUM, &op, &org);
+}
+
+static TEEC_Result fs_next_enum(TEEC_Session *sess, uint32_t e, void *obj_info,
+ size_t info_size, void *id, uint32_t id_size)
+{
+ TEEC_Operation op;
+ uint32_t org;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT,
+ TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE);
+
+ op.params[0].value.a = e;
+ op.params[1].tmpref.buffer = obj_info;
+ op.params[1].tmpref.size = info_size;
+ op.params[2].tmpref.buffer = id;
+ op.params[2].tmpref.size = id_size;
+
+ return TEEC_InvokeCommand(sess, TA_STORAGE_CMD_NEXT_ENUM, &op, &org);
+}
+
+/* create */
+static void xtest_tee_test_6001(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj;
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_00, sizeof(file_00),
+ TEE_DATA_FLAG_ACCESS_WRITE |
+ TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
+ sizeof(data_00), &obj)))
+ goto exit;
+
+ /* clean */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+/* open */
+static void xtest_tee_test_6002(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj;
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_WRITE, 0, data_00,
+ sizeof(data_00), &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
+ goto exit;
+
+ /* clean */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+/* read */
+static void xtest_tee_test_6003(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj;
+ uint8_t out[10] = { 0 };
+ uint32_t count;
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
+ sizeof(data_01), &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_READ |
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
+ goto exit;
+
+ (void)ADBG_EXPECT_BUFFER(c, data_01, 10, out, count);
+
+ /* clean */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+/* write */
+static void xtest_tee_test_6004(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj;
+ uint8_t out[10] = { 0 };
+ uint32_t count;
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ /* create */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
+ sizeof(data_01), &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
+ goto exit;
+
+ /* write new data */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_WRITE, &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_write(&sess, obj, data_00, sizeof(data_00))))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
+ goto exit;
+
+ /* verify */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_READ |
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
+ goto exit;
+
+ (void)ADBG_EXPECT_BUFFER(c, data_00, 10, out, count);
+
+ /* clean */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+/* seek */
+static void xtest_tee_test_6005(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj;
+ uint8_t out[10] = { 0 };
+ uint32_t count;
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ /* create */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_WRITE |
+ TEE_DATA_FLAG_ACCESS_READ |
+ TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
+ sizeof(data_00), &obj)))
+ goto exit;
+
+ /* seek */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_seek(&sess, obj, 10, TEE_DATA_SEEK_SET)))
+ goto exit;
+
+ /* verify */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
+ goto exit;
+
+ (void)ADBG_EXPECT_BUFFER(c, &data_00[10], 10, out, count);
+
+ /* clean */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+/* unlink */
+static void xtest_tee_test_6006(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj;
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ /* create */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
+ sizeof(data_00), &obj)))
+ goto exit;
+
+ /* del & close */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
+ goto exit;
+
+ /* check result */
+ if (!ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_ITEM_NOT_FOUND,
+ fs_open(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_READ, &obj)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+/* trunc */
+static void xtest_tee_test_6007(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj;
+ uint8_t out[10] = { 0 };
+ uint32_t count;
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ /* create */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_WRITE |
+ TEE_DATA_FLAG_ACCESS_READ |
+ TEE_DATA_FLAG_ACCESS_WRITE_META, 0, data_00,
+ sizeof(data_00), &obj)))
+ goto exit;
+
+ /* trunc */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_trunc(&sess, obj, 10)))
+ goto exit;
+
+ /* seek */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(
+ c, fs_seek(&sess, obj, 5, TEE_DATA_SEEK_SET)))
+ goto exit;
+
+ /* verify */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
+ goto exit;
+
+ /* check buffer */
+ (void)ADBG_EXPECT_BUFFER(c, &data_00[5], 5, out, count);
+
+ /* clean */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+static void xtest_tee_test_6008(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj;
+ uint8_t out[10] = { 0 };
+ uint32_t count;
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ /* create */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
+ sizeof(data_01), &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_WRITE |
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
+ goto exit;
+
+ /* write new data */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_write(&sess, obj, data_00, sizeof(data_00))))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_rename(&sess, obj, file_03, sizeof(file_03))))
+ goto exit;
+
+ /* close */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
+ goto exit;
+
+ /* verify */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_03, sizeof(file_03),
+ TEE_DATA_FLAG_ACCESS_READ |
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
+ goto exit;
+
+ /* check buffer */
+ (void)ADBG_EXPECT_BUFFER(c, data_00, 10, out, count);
+
+ /* clean */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+static void xtest_tee_test_6009(ADBG_Case_t *c)
+{
+ TEEC_Session sess;
+ uint32_t obj0;
+ uint32_t obj1;
+ uint32_t obj2;
+ uint32_t e = 0;
+ uint8_t info[200];
+ uint8_t id[200];
+ uint32_t orig;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+ return;
+
+ /* create file 00 */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_00, sizeof(file_00),
+ TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
+ sizeof(data_01), &obj0)))
+ goto exit;
+
+ /* create file 01 */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
+ sizeof(data_01), &obj1)))
+ goto exit;
+
+ /* create file 02 */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_create(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_WRITE, 0, data_01,
+ sizeof(data_01), &obj2)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj0)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj1)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj2)))
+ goto exit;
+
+ /* iterate */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_alloc_enum(&sess, &e)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_start_enum(&sess, e)))
+ goto exit;
+
+ /* get 00 */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id))))
+ goto exit;
+
+ /* get 01 */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id))))
+ goto exit;
+
+ /* get 02 */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id))))
+ goto exit;
+
+ /* we should not have more files */
+ if (!ADBG_EXPECT_TEEC_RESULT(c, TEEC_ERROR_ITEM_NOT_FOUND,
+ fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id))))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_free_enum(&sess, e)))
+ goto exit;
+
+ /* clean */
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_00, sizeof(file_00),
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj0)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj0)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_01, sizeof(file_01),
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj1)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj1)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+ fs_open(&sess, file_02, sizeof(file_02),
+ TEE_DATA_FLAG_ACCESS_WRITE_META, &obj2)))
+ goto exit;
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj2)))
+ goto exit;
+
+exit:
+ TEEC_CloseSession(&sess);
+}
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6001, xtest_tee_test_6001,
+ /* Title */
+ "Test TEE_CreatePersistentObject",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6002, xtest_tee_test_6002,
+ /* Title */
+ "Test TEE_OpenPersistentObject",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6003, xtest_tee_test_6003,
+ /* Title */
+ "Test TEE_ReadObjectData",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6004, xtest_tee_test_6004,
+ /* Title */
+ "Test TEE_WriteObjectData",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6005, xtest_tee_test_6005,
+ /* Title */
+ "Test TEE_SeekObjectData",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6006, xtest_tee_test_6006,
+ /* Title */
+ "Test TEE_CloseAndDeletePersistentObject",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6007, xtest_tee_test_6007,
+ /* Title */
+ "Test TEE_TruncateObjectData",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6008, xtest_tee_test_6008,
+ /* Title */
+ "Test TEE_RenamePersistentObject",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
+
+ADBG_CASE_DEFINE(
+ XTEST_TEE_6009, xtest_tee_test_6009,
+ /* Title */
+ "Test TEE Internal API Persistent Object Enumeration Functions",
+ /* Short description */
+ "Short description ...",
+ /* Requirement IDs */
+ "TEE-??",
+ /* How to implement */
+ "Description of how to implement ..."
+ );
diff --git a/host/xtest/xtest_7000.c b/host/xtest/xtest_7000.c
new file mode 100644
index 0000000..210c55d
--- /dev/null
+++ b/host/xtest/xtest_7000.c
@@ -0,0 +1,529 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "xtest_test.h"
+#include "xtest_helpers.h"
+#include "tee_internal_api.h"
+#include "tee_api_defines.h"
+#include "tee_client_api.h"
+#include "xml_client_api.h"
+
+static bool xtest_init = false;
+
+static bool xtest_tee_init(ADBG_Case_t *c)
+{
+ if (xtest_init)
+ return true;
+
+ SHARE_MEM01 = malloc(sizeof(TEEC_SharedMemory));
+ if (!ADBG_EXPECT_NOT_NULL(c, SHARE_MEM01))
+ goto exit;
+
+ SHARE_MEM02 = malloc(sizeof(TEEC_SharedMemory));
+ if (!ADBG_EXPECT_NOT_NULL(c, SHARE_MEM02))
+ goto exit;
+
+ SESSION01 = malloc(sizeof(TEEC_Session));
+ if (!ADBG_EXPECT_NOT_NULL(c, SESSION01))
+ goto exit;
+
+ CONTEXT01 = malloc(sizeof(TEEC_Context));
+ if (!ADBG_EXPECT_NOT_NULL(c, CONTEXT01))
+ goto exit;
+
+ OPERATION01 = malloc(sizeof(TEEC_Operation));
+ if (!ADBG_EXPECT_NOT_NULL(c, OPERATION01))
+ goto exit;
+
+ OPERATION02 = malloc(sizeof(TEEC_Operation));
+ if (!ADBG_EXPECT_NOT_NULL(c, OPERATION02))
+ goto exit;
+
+ xtest_init = true;
+
+ return xtest_init;
+
+exit:
+ if (SHARE_MEM01) {
+ free(SHARE_MEM01);
+ SHARE_MEM01 = NULL;
+ }
+ if (SHARE_MEM02) {
+ free(SHARE_MEM02);
+ SHARE_MEM02 = NULL;
+ }
+ if (SESSION01) {
+ free(SESSION01);
+ SESSION01 = NULL;
+ }
+ if (CONTEXT01) {
+ free(CONTEXT01);
+ CONTEXT01 = NULL;
+ }
+ if (OPERATION01) {
+ free(OPERATION01);
+ OPERATION01 = NULL;
+ }
+ if (OPERATION02) {
+ free(OPERATION02);
+ OPERATION02 = NULL;
+ }
+
+ xtest_init = false;
+ return xtest_init;
+}
+
+/*29-84-6d*/
+static void xtest_tee_7001(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_SUCCESS,
+ AllocateSharedMemory(CONTEXT01, SHARE_MEM01, SIZE_VALUE01,
+ TEEC_MEM_INPUT));
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-c2-4c*/
+static void xtest_tee_7002(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_ERROR_OUT_OF_MEMORY,
+ AllocateSharedMemory(CONTEXT01, SHARE_MEM01,
+ SIZE_OVER_MEMORY, TEEC_MEM_INPUT));
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-b0-da*/
+static void xtest_tee_7003(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_SUCCESS,
+ AllocateSharedMemory(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEM_OUTPUT));
+ TEEC_ReleaseSharedMemory(NULL);
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-1c-00*/
+static void xtest_tee_7004(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_SUCCESS,
+ AllocateSharedMemory(CONTEXT01, SHARE_MEM01, SIZE_VALUE01,
+ TEEC_MEM_INOUT));
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-9f-a2*/
+static void xtest_tee_7005(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_SUCCESS,
+ RegisterSharedMemory(CONTEXT01, SHARE_MEM01, SIZE_VALUE01,
+ TEEC_MEM_INPUT));
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-11-02*/
+static void xtest_tee_7006(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_SUCCESS,
+ RegisterSharedMemory(CONTEXT01, SHARE_MEM01, SIZE_VALUE01,
+ TEEC_MEM_OUTPUT));
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-1f-a2*/
+static void xtest_tee_7007(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_SUCCESS,
+ RegisterSharedMemory(CONTEXT01, SHARE_MEM01, BIG_SIZE,
+ TEEC_MEM_INOUT));
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-2e-8d*/
+static void xtest_tee_7008(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_SUCCESS,
+ RegisterSharedMemory(CONTEXT01, SHARE_MEM01, ZERO,
+ TEEC_MEM_OUTPUT));
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-2b-3f*/
+static void xtest_tee_7009(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ XML_OpenSession(c, CONTEXT01, SESSION01, &UUID_Unknown,
+ TEEC_LOGIN_PUBLIC, NULL, NULL,
+ TEEC_ORIGIN_ANY_NOT_TRUSTED_APP, TEEC_UNDEFINED_ERROR);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-cd-39*/
+static void xtest_tee_7010(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ ADBG_EXPECT(c, TEEC_SUCCESS,
+ AllocateSharedMemory(CONTEXT01, SHARE_MEM01, ZERO,
+ TEEC_MEM_OUTPUT));
+ TEEC_ReleaseSharedMemory(SHARE_MEM01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-f0-9c*/
+static void xtest_tee_7011(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ XML_OpenSession(c, CONTEXT01, SESSION01,
+ &UUID_TTA_answerSuccessTo_OpenSession_Invoke,
+ TEEC_LOGIN_PUBLIC, NULL, NULL, 0, TEEC_SUCCESS);
+ TEEC_CloseSession(SESSION01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-4d-b0*/
+static void xtest_tee_7012(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ XML_OpenSession(c, CONTEXT01, SESSION01,
+ &UUID_TTA_answerErrorTo_OpenSession, TEEC_LOGIN_PUBLIC,
+ NULL, NULL, TEEC_ORIGIN_TRUSTED_APP,
+ TEEC_ERROR_GENERIC);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-a2-e3*/
+static void xtest_tee_7013(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ XML_OpenSession(c, CONTEXT01, SESSION01,
+ &UUID_TTA_answerSuccessTo_OpenSession_Invoke,
+ INVALID_CONNECTION_METHODS, NULL, NULL,
+ TEEC_ORIGIN_ANY_NOT_TRUSTED_APP, TEEC_UNDEFINED_ERROR);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-5d-d8*/
+static void xtest_tee_7014(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ OPERATION_TEEC_PARAM_TYPES(OPERATION01, TEEC_VALUE_INPUT,
+ TEEC_VALUE_INPUT, TEEC_VALUE_INPUT,
+ TEEC_VALUE_INPUT);
+
+ TEEC_prepare_OperationEachParameter_value(OPERATION01, 0, VALUE01,
+ IGNORE);
+ TEEC_prepare_OperationEachParameter_value(OPERATION01, 1, IGNORE,
+ VALUE01);
+ TEEC_prepare_OperationEachParameter_value(OPERATION01, 2, VALUE01,
+ VALUE01);
+ TEEC_prepare_OperationEachParameter_value(OPERATION01, 3, VALUE01,
+ VALUE02);
+
+ XML_OpenSession(c, CONTEXT01, SESSION01,
+ &UUID_TTA_check_OpenSession_with_4_parameters,
+ TEEC_LOGIN_PUBLIC, NULL, OPERATION01, 0,
+ TEEC_SUCCESS);
+ TEEC_CloseSession(SESSION01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-82-81*/
+static void xtest_tee_7015(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ XML_OpenSession(c, CONTEXT01, SESSION01,
+ &UUID_TTA_answerSuccessTo_OpenSession_Invoke,
+ TEEC_LOGIN_PUBLIC, NULL, NULL, TEEC_ORIGIN_TRUSTED_APP,
+ TEEC_SUCCESS);
+ TEEC_CloseSession(SESSION01);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+/*29-db-48*/
+static void xtest_tee_7016(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ TEEC_CloseSession(NULL);
+}
+
+/*29-a1-83*/
+static void xtest_tee_7017(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, INVALID_NOT_EXISTING_TEE, CONTEXT01,
+ TEEC_UNDEFINED_ERROR);
+}
+
+/*29-c1-a5*/
+static void xtest_tee_7018(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ TEEC_FinalizeContext(NULL);
+}
+
+/*29-91-aa*/
+static void xtest_tee_7019(ADBG_Case_t *c)
+{
+ if (!ADBG_EXPECT_TRUE(c, xtest_tee_init(c)))
+ return;
+ TEEC_createThread(CLIENT_APP01, THREAD02);
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ XML_InitializeContext(c, _device, CONTEXT01, TEEC_SUCCESS);
+ TEEC_SelectApp(CLIENT_APP01, THREAD02);
+ thr2_ctx.c = c;
+ thr2_ctx.ctx = CONTEXT01;
+ ctx_init_finalize(thr2_ctx);
+ TEEC_SelectApp(CLIENT_APP01, THREAD01_DEFAULT);
+ TEEC_FinalizeContext(CONTEXT01);
+}
+
+ADBG_CASE_DEFINE(XTEST_TEE_7001, xtest_tee_7001,
+ /* Title */
+ "29-84-6d",
+ /* Short description */
+ "Allocate_In",
+ /* Requirement IDs */
+ "RELEASE_SHARED_MEMORY_WHEN_ALLOCATED",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7002, xtest_tee_7002,
+ /* Title */
+ "29-c2-4c",
+ /* Short description */
+ "Allocate_out_of_memory",
+ /* Requirement IDs */
+ "INITIALIZE_CONTEXT_NAMES",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7003, xtest_tee_7003,
+ /* Title */
+ "29-b0-da",
+ /* Short description */
+ "ReleaseSharedMemory_null",
+ /* Requirement IDs */
+ "RELEASE_SHARED_MEMORY_WHEN_ALLOCATED",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7004, xtest_tee_7004,
+ /* Title */
+ "29-1c-00",
+ /* Short description */
+ "Allocate_InOut",
+ /* Requirement IDs */
+ "RELEASE_SHARED_MEMORY_WHEN_ALLOCATED",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7005, xtest_tee_7005,
+ /* Title */
+ "29-9f-a2",
+ /* Short description */
+ "Register_In",
+ /* Requirement IDs */
+ "RELEASE_SHARED_MEMORY_WHEN_REGISTERED",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7006, xtest_tee_7006,
+ /* Title */
+ "29-11-02",
+ /* Short description */
+ "Register_notZeroLength_Out",
+ /* Requirement IDs */
+ "RELEASE_SHARED_MEMORY_WHEN_REGISTERED",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7007, xtest_tee_7007,
+ /* Title */
+ "29-1f-a2",
+ /* Short description */
+ "Register_InOut",
+ /* Requirement IDs */
+ "RELEASE_SHARED_MEMORY_WHEN_REGISTERED",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7008, xtest_tee_7008,
+ /* Title */
+ "29-2e-8d",
+ /* Short description */
+ "Register_zeroLength_Out",
+ /* Requirement IDs */
+ "RELEASE_SHARED_MEMORY_WHEN_REGISTERED",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7009, xtest_tee_7009,
+ /* Title */
+ "29-2b-3f",
+ /* Short description */
+ "OpenSession_error_notExistingTA",
+ /* Requirement IDs */
+ "OPEN_SESSION_TARGET_TRUSTED_APP",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7010, xtest_tee_7010,
+ /* Title */
+ "29-cd-39",
+ /* Short description */
+ "Allocate_Out",
+ /* Requirement IDs */
+ "RELEASE_SHARED_MEMORY_WHEN_ALLOCATED",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7011, xtest_tee_7011,
+ /* Title */
+ "29-f0-9c",
+ /* Short description */
+ "OpenSession_success_nullReturnOrigin",
+ /* Requirement IDs */
+ "OPEN_SESSION_TARGET_TRUSTED_APP",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7012, xtest_tee_7012,
+ /* Title */
+ "29-4d-b0",
+ /* Short description */
+ "OpenSession_error_originTrustedApp",
+ /* Requirement IDs */
+ "OPEN_SESSION_TARGET_TRUSTED_APP",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7013, xtest_tee_7013,
+ /* Title */
+ "29-a2-e3",
+ /* Short description */
+ "OpenSession_error_originTEE",
+ /* Requirement IDs */
+ "OPEN_SESSION_TARGET_TRUSTED_APP",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7014, xtest_tee_7014,
+ /* Title */
+ "29-5d-d8",
+ /* Short description */
+ "OpenSession_with_operation_parameters",
+ /* Requirement IDs */
+ "OPEN_SESSION_TARGET_TRUSTED_APP",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7015, xtest_tee_7015,
+ /* Title */
+ "29-82-81",
+ /* Short description */
+ "OpenSession_success_originTrustedApp",
+ /* Requirement IDs */
+ "OPEN_SESSION_TARGET_TRUSTED_APP",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7016, xtest_tee_7016,
+ /* Title */
+ "29-db-48",
+ /* Short description */
+ "CloseSession_null",
+ /* Requirement IDs */
+ "CLOSE_SESSION_IGNORE_SESSION_NULL",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7017, xtest_tee_7017,
+ /* Title */
+ "29-a1-83",
+ /* Short description */
+ "InitializeContext_NotExistingTEE",
+ /* Requirement IDs */
+ "INITIALIZE_CONTEXT_NAMES",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7018, xtest_tee_7018,
+ /* Title */
+ "29-c1-a5",
+ /* Short description */
+ "FinalizeContext_null",
+ /* Requirement IDs */
+ "FINALIZE_CONTEXT_IGNORE_NULL",
+ /* How to implement */
+ "Description of how to implement ...");
+ADBG_CASE_DEFINE(XTEST_TEE_7019, xtest_tee_7019,
+ /* Title */
+ "29-91-aa",
+ /* Short description */
+ "InitializeContext_concurrentContext",
+ /* Requirement IDs */
+ "INITIALIZE_CONTEXT_NAMES",
+ /* How to implement */
+ "Description of how to implement ...");
diff --git a/host/xtest/xtest_helpers.c b/host/xtest/xtest_helpers.c
new file mode 100644
index 0000000..51b1c19
--- /dev/null
+++ b/host/xtest/xtest_helpers.c
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "xtest_helpers.h"
+#include "xtest_test.h"
+
+#include <ta_crypt.h>
+#include <utee_defines.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <malloc.h>
+#include <assert.h>
+
+/* Round up the even multiple of size, size has to be a multiple of 2 */
+#define ROUNDUP(v, size) (((v) + (size - 1)) & ~(size - 1))
+
+TEEC_Context xtest_teec_ctx;
+
+TEEC_Result xtest_teec_ctx_init(void)
+{
+ return TEEC_InitializeContext(_device, &xtest_teec_ctx);
+}
+
+TEEC_Result xtest_teec_open_session(TEEC_Session *session,
+ const TEEC_UUID *uuid, TEEC_Operation *op,
+ uint32_t *ret_orig)
+{
+ return TEEC_OpenSession(&xtest_teec_ctx, session, uuid,
+ TEEC_LOGIN_PUBLIC, NULL, op, ret_orig);
+}
+
+void xtest_teec_ctx_deinit(void)
+{
+ TEEC_FinalizeContext(&xtest_teec_ctx);
+}
+
+TEEC_Result ta_crypt_cmd_allocate_operation(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle *oph,
+ uint32_t algo, uint32_t mode,
+ uint32_t max_key_size)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = 0;
+ op.params[0].value.b = algo;
+ op.params[1].value.a = mode;
+ op.params[1].value.b = max_key_size;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INOUT, TEEC_VALUE_INPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_ALLOCATE_OPERATION, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *oph = (TEE_OperationHandle)(uintptr_t)op.params[0].value.a;
+
+ return res;
+}
+
+TEEC_Result ta_crypt_cmd_allocate_transient_object(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectType obj_type,
+ uint32_t max_obj_size,
+ TEE_ObjectHandle *o)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = obj_type;
+ op.params[0].value.b = max_obj_size;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_VALUE_OUTPUT,
+ TEEC_NONE, TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_ALLOCATE_TRANSIENT_OBJECT, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *o = (TEE_ObjectHandle)(uintptr_t)op.params[1].value.a;
+
+ return res;
+}
+
+void xtest_add_attr(size_t *attr_count, TEE_Attribute *attrs, uint32_t attr_id,
+ const void *buf, size_t len)
+{
+ attrs[*attr_count].attributeID = attr_id;
+ attrs[*attr_count].content.ref.buffer = (void *)buf;
+ attrs[*attr_count].content.ref.length = len;
+ (*attr_count)++;
+}
+
+struct tee_attr_packed {
+ uint32_t attr_id;
+ uint32_t a;
+ uint32_t b;
+};
+
+TEE_Result pack_attrs(const TEE_Attribute *attrs, uint32_t attr_count,
+ uint8_t **buf, size_t *blen)
+{
+ struct tee_attr_packed *a;
+ uint8_t *b;
+ size_t bl;
+ size_t n;
+
+ *buf = NULL;
+ *blen = 0;
+ if (attr_count == 0)
+ return TEE_SUCCESS;
+
+ bl = sizeof(uint32_t) + sizeof(struct tee_attr_packed) * attr_count;
+ for (n = 0; n < attr_count; n++) {
+ if ((attrs[n].attributeID & TEE_ATTR_BIT_VALUE) != 0)
+ continue; /* Only memrefs need to be updated */
+
+ if (!attrs[n].content.ref.buffer)
+ continue;
+
+ /* Make room for padding */
+ bl += ROUNDUP(attrs[n].content.ref.length, 4);
+ }
+
+ b = calloc(1, bl);
+ if (!b)
+ return TEE_ERROR_OUT_OF_MEMORY;
+
+ *buf = b;
+ *blen = bl;
+
+ *(uint32_t *)(void *)b = attr_count;
+ b += sizeof(uint32_t);
+ a = (struct tee_attr_packed *)(void *)b;
+ b += sizeof(struct tee_attr_packed) * attr_count;
+
+ for (n = 0; n < attr_count; n++) {
+ a[n].attr_id = attrs[n].attributeID;
+ if (attrs[n].attributeID & TEE_ATTR_BIT_VALUE) {
+ a[n].a = attrs[n].content.value.a;
+ a[n].b = attrs[n].content.value.b;
+ continue;
+ }
+
+ a[n].b = attrs[n].content.ref.length;
+
+ if (!attrs[n].content.ref.buffer) {
+ a[n].a = 0;
+ continue;
+ }
+
+ memcpy(b, attrs[n].content.ref.buffer,
+ attrs[n].content.ref.length);
+
+ /* Make buffer pointer relative to *buf */
+ a[n].a = (uint32_t)(uintptr_t)(b - *buf);
+
+ /* Round up to good alignment */
+ b += ROUNDUP(attrs[n].content.ref.length, 4);
+ }
+
+ return TEE_SUCCESS;
+}
+
+TEEC_Result ta_crypt_cmd_populate_transient_object(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectHandle o,
+ const TEE_Attribute *attrs,
+ uint32_t attr_count)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ uint8_t *buf;
+ size_t blen;
+
+ res = pack_attrs(attrs, attr_count, &buf, &blen);
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, res))
+ return res;
+
+ assert((uintptr_t)o <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)o;
+
+ op.params[1].tmpref.buffer = buf;
+ op.params[1].tmpref.size = blen;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_POPULATE_TRANSIENT_OBJECT, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ free(buf);
+ return res;
+}
+
+TEE_Result ta_crypt_cmd_set_operation_key(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph,
+ TEE_ObjectHandle key)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ assert((uintptr_t)key <= UINT32_MAX);
+ op.params[0].value.b = (uint32_t)(uintptr_t)key;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_SET_OPERATION_KEY, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
+
+TEEC_Result ta_crypt_cmd_free_transient_object(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_ObjectHandle o)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)o <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)o;
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_FREE_TRANSIENT_OBJECT, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
+
+TEEC_Result ta_crypt_cmd_derive_key(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph, TEE_ObjectHandle o,
+ const TEE_Attribute *params,
+ uint32_t paramCount)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+ uint8_t *buf;
+ size_t blen;
+
+ res = pack_attrs(params, paramCount, &buf, &blen);
+
+ if (!ADBG_EXPECT_TEEC_SUCCESS(c, res))
+ return res;
+
+ assert((uintptr_t)oph <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ assert((uintptr_t)o <= UINT32_MAX);
+ op.params[0].value.b = (uint32_t)(uintptr_t)o;
+
+ op.params[1].tmpref.buffer = buf;
+ op.params[1].tmpref.size = blen;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_INPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_DERIVE_KEY, &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ free(buf);
+ return res;
+}
+
+TEEC_Result ta_crypt_cmd_get_object_buffer_attribute(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectHandle o,
+ uint32_t attr_id,
+ void *buf, size_t *blen)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ assert((uintptr_t)o <= UINT32_MAX);
+ op.params[0].value.a = (uint32_t)(uintptr_t)o;
+ op.params[0].value.b = attr_id;
+
+ op.params[1].tmpref.buffer = buf;
+ op.params[1].tmpref.size = *blen;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
+ TEEC_MEMREF_TEMP_OUTPUT, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_GET_OBJECT_BUFFER_ATTRIBUTE,
+ &op, &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ if (res == TEEC_SUCCESS)
+ *blen = op.params[1].tmpref.size;
+
+ return res;
+}
+
+TEEC_Result ta_crypt_cmd_free_operation(ADBG_Case_t *c, TEEC_Session *s,
+ TEE_OperationHandle oph)
+{
+ TEEC_Result res;
+ TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+ uint32_t ret_orig;
+
+ op.params[0].value.a = (uint32_t)(uintptr_t)oph;
+
+ op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT, TEEC_NONE, TEEC_NONE,
+ TEEC_NONE);
+
+ res = TEEC_InvokeCommand(s, TA_CRYPT_CMD_FREE_OPERATION, &op,
+ &ret_orig);
+
+ if (res != TEEC_SUCCESS) {
+ (void)ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, TEEC_ORIGIN_TRUSTED_APP,
+ ret_orig);
+ }
+
+ return res;
+}
diff --git a/host/xtest/xtest_helpers.h b/host/xtest/xtest_helpers.h
new file mode 100644
index 0000000..53c2d71
--- /dev/null
+++ b/host/xtest/xtest_helpers.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef XTEST_HELPERS_H
+#define XTEST_HELPERS_H
+
+#include <tee_client_api.h>
+#include <tee_api_types.h>
+#include <adbg.h>
+
+/* Global context to use if any context is needed as input to a function */
+extern TEEC_Context xtest_teec_ctx;
+
+/*
+ * Initializes the context above, should be called before the ADBG test
+ * cases are run.
+ */
+TEEC_Result xtest_teec_ctx_init(void);
+void xtest_teec_ctx_deinit(void);
+
+/* Opens a session */
+TEEC_Result xtest_teec_open_session(TEEC_Session *session,
+ const TEEC_UUID *uuid, TEEC_Operation *op,
+ uint32_t *ret_orig);
+
+TEEC_Result xtest_teec_open_static_session(TEEC_Session *session,
+ TEEC_Operation *op,
+ uint32_t *ret_orig);
+
+#define TEEC_OPERATION_INITIALIZER { 0, 0, { { { 0 } } } }
+
+/* IO access macro */
+#define IO(addr) (*((volatile unsigned long *)(addr)))
+
+/*
+ * Helpers for commands towards the crypt TA
+ */
+TEEC_Result ta_crypt_cmd_allocate_operation(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle *oph,
+ uint32_t algo,
+ uint32_t mode,
+ uint32_t max_key_size);
+
+TEEC_Result ta_crypt_cmd_allocate_transient_object(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectType obj_type, uint32_t max_obj_size,
+ TEE_ObjectHandle *o);
+
+TEEC_Result ta_crypt_cmd_populate_transient_object(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectHandle o,
+ const TEE_Attribute *attrs,
+ uint32_t attr_count);
+
+TEE_Result ta_crypt_cmd_set_operation_key(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ TEE_ObjectHandle key);
+
+TEEC_Result ta_crypt_cmd_free_transient_object(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectHandle o);
+
+TEEC_Result ta_crypt_cmd_derive_key(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph,
+ TEE_ObjectHandle o,
+ const TEE_Attribute *params,
+ uint32_t paramCount);
+
+TEEC_Result ta_crypt_cmd_get_object_buffer_attribute(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_ObjectHandle o,
+ uint32_t attr_id,
+ void *buf,
+ size_t *blen);
+
+TEEC_Result ta_crypt_cmd_free_operation(ADBG_Case_t *c,
+ TEEC_Session *s,
+ TEE_OperationHandle oph);
+
+void xtest_add_attr(size_t *attr_count, TEE_Attribute *attrs,
+ uint32_t attr_id, const void *buf, size_t len);
+
+TEE_Result pack_attrs(const TEE_Attribute *attrs, uint32_t attr_count,
+ uint8_t **buf, size_t *blen);
+
+#endif /*XTEST_HELPERS_H*/
diff --git a/host/xtest/xtest_main.c b/host/xtest/xtest_main.c
new file mode 100644
index 0000000..73e55e2
--- /dev/null
+++ b/host/xtest/xtest_main.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <adbg.h>
+#include "xtest_test.h"
+#include "xtest_helpers.h"
+#include "adbg_entry_declare.h"
+
+ADBG_SUITE_DECLARE(XTEST_TEE_TEST)
+
+/*ADBG Suite definition.*/
+ADBG_SUITE_DEFINE_BEGIN(XTEST_TEE_TEST, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1001, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1004, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1005, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1006, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1007, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1008, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1009, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1010, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1011, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_1012, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4001, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4002, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4003_NO_XTS, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4003_XTS, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4004, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4005, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4006, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4007, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_4008, NULL)
+/* FVP ADBG_SUITE_ENTRY(XTEST_TEE_5006, NULL) */
+#ifdef USER_SPACE
+ADBG_SUITE_ENTRY(XTEST_TEE_6001, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6002, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6003, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6004, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6005, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6006, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6007, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6008, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6009, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7001, NULL)
+/* FVP ADBG_SUITE_ENTRY(XTEST_TEE_7002, NULL) */
+ADBG_SUITE_ENTRY(XTEST_TEE_7003, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7004, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7005, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7006, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7007, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7008, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7009, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7010, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7013, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7016, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7017, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7018, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_7019, NULL)
+#ifdef XTEST_WITH_GP_TESTS
+ADBG_ENTRY_AUTO_GENERATED_TESTS()
+#else
+#endif
+#endif /*USER_SPACE*/
+ADBG_SUITE_ENTRY(XTEST_TEE_10001, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_10002, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_10003, NULL)
+ADBG_SUITE_DEFINE_END()
+
+static const char gdevname_tz[] = "opteearmtz00";
+char *_device = (char *)gdevname_tz;
+
+int main(int argc, char *argv[])
+{
+ argv++;
+ argc--;
+
+ if (argc >= 1) {
+ if (strcmp(argv[0], gdevname_tz) == 0) {
+ _device = argv[0];
+ argv++;
+ argc--;
+ }
+ }
+ printf("\nTEE test application started with device [%s]\n", _device);
+
+ xtest_teec_ctx_init();
+
+ int ret = Do_ADBG_RunSuite(&ADBG_Suite_XTEST_TEE_TEST, argc, argv);
+
+ xtest_teec_ctx_deinit();
+
+ printf("TEE test application done!\n");
+ return ret;
+}
diff --git a/host/xtest/xtest_test.c b/host/xtest/xtest_test.c
new file mode 100644
index 0000000..8fae19b
--- /dev/null
+++ b/host/xtest/xtest_test.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "xtest_test.h"
+#include <tee_client_api.h>
+#include <ta_create_fail_test.h>
+#include <ta_crypt.h>
+#include <ta_os_test.h>
+#include <ta_rpc_test.h>
+#include <ta_sims_test.h>
+#include <ta_storage.h>
+#include <enc_fs_key_manager_test.h>
+#include <tee_api_defines.h>
+
+ADBG_ENUM_TABLE_DEFINE_BEGIN(TEEC_Result)
+ADBG_ENUM_TABLE_ENTRY(TEEC_SUCCESS),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_CORRUPT_OBJECT),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_CORRUPT_OBJECT_2),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_STORAGE_NOT_AVAILABLE),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_STORAGE_NOT_AVAILABLE_2),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_GENERIC),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_ACCESS_DENIED),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_CANCEL),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_ACCESS_CONFLICT),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_EXCESS_DATA),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_BAD_FORMAT),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_BAD_PARAMETERS),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_BAD_STATE),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_ITEM_NOT_FOUND),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_NOT_IMPLEMENTED),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_NOT_SUPPORTED),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_NO_DATA),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_OUT_OF_MEMORY),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_BUSY),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_COMMUNICATION),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_SECURITY),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_SHORT_BUFFER),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_EXTERNAL_CANCEL),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_OVERFLOW),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_TARGET_DEAD),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_STORAGE_NO_SPACE),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_MAC_INVALID),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_SIGNATURE_INVALID),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_TIME_NOT_SET),
+ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_TIME_NEEDS_RESET)
+ADBG_ENUM_TABLE_DEFINE_END(TEEC_Result);
+
+ADBG_ENUM_TABLE_DEFINE_BEGIN(TEEC_ErrorOrigin)
+ADBG_ENUM_TABLE_ENTRY(TEEC_ORIGIN_API),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ORIGIN_COMMS),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ORIGIN_TEE),
+ADBG_ENUM_TABLE_ENTRY(TEEC_ORIGIN_TRUSTED_APP)
+ADBG_ENUM_TABLE_DEFINE_END(TEEC_ErrorOrigin);
+
+#define ECC_SELF_TEST_UUID \
+ { 0xf34f4f3c, 0xab30, 0x4573, \
+ { 0x91, 0xBF, 0x3C, 0x57, 0x02, 0x4D, 0x51, 0x99 } }
+
+const TEEC_UUID crypt_user_ta_uuid = TA_CRYPT_UUID;
+const TEEC_UUID os_test_ta_uuid = TA_OS_TEST_UUID;
+const TEEC_UUID create_fail_test_ta_uuid = TA_CREATE_FAIL_TEST_UUID;
+const TEEC_UUID ecc_test_ta_uuid = ECC_SELF_TEST_UUID;
+const TEEC_UUID rpc_test_ta_uuid = TA_RPC_TEST_UUID;
+const TEEC_UUID sims_test_ta_uuid = TA_SIMS_TEST_UUID;
+const TEEC_UUID storage_ta_uuid = TA_STORAGE_UUID;
+const TEEC_UUID enc_fs_key_manager_test_ta_uuid = ENC_FS_KEY_MANAGER_TEST_UUID;
+
diff --git a/host/xtest/xtest_test.h b/host/xtest/xtest_test.h
new file mode 100644
index 0000000..0bad613
--- /dev/null
+++ b/host/xtest/xtest_test.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2014, STMicroelectronics International N.V.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef XTEST_TEST_H
+#define XTEST_TEST_H
+#include <adbg.h>
+#include <tee_client_api.h>
+#include "adbg_case_declare.h"
+
+/*ADBG Cases declaration.*/
+ADBG_CASE_DECLARE(XTEST_TEE_1001);
+ADBG_CASE_DECLARE(XTEST_TEE_1004);
+ADBG_CASE_DECLARE(XTEST_TEE_1005);
+ADBG_CASE_DECLARE(XTEST_TEE_1006);
+ADBG_CASE_DECLARE(XTEST_TEE_1007);
+ADBG_CASE_DECLARE(XTEST_TEE_1008);
+ADBG_CASE_DECLARE(XTEST_TEE_1009);
+ADBG_CASE_DECLARE(XTEST_TEE_1010);
+ADBG_CASE_DECLARE(XTEST_TEE_1011);
+ADBG_CASE_DECLARE(XTEST_TEE_1012);
+
+ADBG_CASE_DECLARE(XTEST_TEE_2001);
+ADBG_CASE_DECLARE(XTEST_TEE_2002);
+
+ADBG_CASE_DECLARE(XTEST_TEE_4001);
+ADBG_CASE_DECLARE(XTEST_TEE_4002);
+ADBG_CASE_DECLARE(XTEST_TEE_4003_NO_XTS);
+ADBG_CASE_DECLARE(XTEST_TEE_4003_XTS);
+ADBG_CASE_DECLARE(XTEST_TEE_4004);
+ADBG_CASE_DECLARE(XTEST_TEE_4005);
+ADBG_CASE_DECLARE(XTEST_TEE_4006);
+ADBG_CASE_DECLARE(XTEST_TEE_4007);
+ADBG_CASE_DECLARE(XTEST_TEE_4008);
+
+ADBG_CASE_DECLARE(XTEST_TEE_5006);
+
+ADBG_CASE_DECLARE(XTEST_TEE_6001);
+ADBG_CASE_DECLARE(XTEST_TEE_6002);
+ADBG_CASE_DECLARE(XTEST_TEE_6003);
+ADBG_CASE_DECLARE(XTEST_TEE_6004);
+ADBG_CASE_DECLARE(XTEST_TEE_6005);
+ADBG_CASE_DECLARE(XTEST_TEE_6006);
+ADBG_CASE_DECLARE(XTEST_TEE_6007);
+ADBG_CASE_DECLARE(XTEST_TEE_6008);
+ADBG_CASE_DECLARE(XTEST_TEE_6009);
+ADBG_CASE_DECLARE(XTEST_TEE_7001);
+ADBG_CASE_DECLARE(XTEST_TEE_7002);
+ADBG_CASE_DECLARE(XTEST_TEE_7003);
+ADBG_CASE_DECLARE(XTEST_TEE_7004);
+ADBG_CASE_DECLARE(XTEST_TEE_7005);
+ADBG_CASE_DECLARE(XTEST_TEE_7006);
+ADBG_CASE_DECLARE(XTEST_TEE_7007);
+ADBG_CASE_DECLARE(XTEST_TEE_7008);
+ADBG_CASE_DECLARE(XTEST_TEE_7009);
+ADBG_CASE_DECLARE(XTEST_TEE_7010);
+ADBG_CASE_DECLARE(XTEST_TEE_7013);
+ADBG_CASE_DECLARE(XTEST_TEE_7016);
+ADBG_CASE_DECLARE(XTEST_TEE_7017);
+ADBG_CASE_DECLARE(XTEST_TEE_7018);
+ADBG_CASE_DECLARE(XTEST_TEE_7019);
+
+ADBG_CASE_DECLARE(XTEST_TEE_10001);
+ADBG_CASE_DECLARE(XTEST_TEE_10002);
+ADBG_CASE_DECLARE(XTEST_TEE_10003);
+
+ADBG_CASE_DECLARE_AUTO_GENERATED_TESTS()
+
+/* TEEC_Result */
+ADBG_ENUM_TABLE_DECLARE(TEEC_Result);
+
+#define ADBG_EXPECT_TEEC_RESULT(c, exp, got) \
+ ADBG_EXPECT_ENUM(c, exp, got, ADBG_EnumTable_TEEC_Result)
+
+#define ADBG_EXPECT_TEEC_SUCCESS(c, got) \
+ ADBG_EXPECT_ENUM(c, TEEC_SUCCESS, got, ADBG_EnumTable_TEEC_Result)
+
+/* TEEC_ErrorOrigin */
+ADBG_ENUM_TABLE_DECLARE(TEEC_ErrorOrigin);
+
+#define ADBG_EXPECT_TEEC_ERROR_ORIGIN(c, exp, got) \
+ ADBG_EXPECT_ENUM(c, exp, got, ADBG_EnumTable_TEEC_ErrorOrigin)
+
+/* bass_return_code */
+ADBG_ENUM_TABLE_DECLARE(bass_return_code);
+
+#define ADBG_EXPECT_BASS_RETURN_CODE(c, exp, got) \
+ ADBG_EXPECT_ENUM(c, exp, got, ADBG_EnumTable_bass_return_code)
+
+#define ADBG_EXPECT_BASS_RC_SUCCESS(c, got) \
+ ADBG_EXPECT_ENUM(c, BASS_RC_SUCCESS, got, \
+ ADBG_EnumTable_bass_return_code)
+
+
+extern const char crypt_user_ta[];
+extern const unsigned int crypt_user_ta_size;
+
+extern const char os_test_ta[];
+extern const unsigned int os_test_ta_size;
+
+extern const char create_fail_test_ta[];
+extern const unsigned int create_fail_test_ta_size;
+
+extern const char rpc_test_ta[];
+extern const unsigned int rpc_test_ta_size;
+
+extern const char sims_test_ta[];
+extern const unsigned int sims_test_ta_size;
+
+extern const char gp_tta_testing_client_api_ta[];
+extern const unsigned int gp_tta_testing_client_api_ta_size;
+
+extern const char gp_tta_answer_success_to_open_session_invoke_ta[];
+extern const unsigned int gp_tta_answer_success_to_open_session_invoke_ta_size;
+
+extern const char gp_tta_answer_error_to_invoke_ta[];
+extern const unsigned int gp_tta_answer_error_to_invoke_ta_size;
+
+extern const char gp_tta_answer_error_to_open_session_ta[];
+extern const unsigned int gp_tta_answer_error_to_open_session_ta_size;
+
+extern const char gp_tta_check_open_session_with_4_parameters_ta[];
+extern const unsigned int gp_tta_check_open_session_with_4_parameters_ta_size;
+
+extern const char gp_tta_ds_ta[];
+extern const unsigned int gp_tta_ds_ta_size;
+
+extern const char storage_ta[];
+extern const unsigned int storage_ta_size;
+
+extern const char gp_tta_time_ta[];
+extern const unsigned int gp_tta_time_ta_size;
+
+extern const char gp_tta_tcf_ta[];
+extern const unsigned int gp_tta_tcf_ta_size;
+
+extern const char gp_tta_crypto_ta[];
+extern const unsigned int gp_tta_crypto_ta_size;
+
+extern const char gp_tta_arithm_ta[];
+extern const unsigned int gp_tta_arithm_ta_size;
+
+extern const char gp_tta_ica_ta[];
+extern const unsigned int gp_tta_ica_ta_size;
+
+extern const char gp_tta_ica2_ta[];
+extern const unsigned int gp_tta_ica2_ta_size;
+
+extern const char gp_tta_tcf_singleinstance_ta[];
+extern const unsigned int gp_tta_tcf_singleinstance_ta_size;
+
+extern const char gp_tta_tcf_multipleinstance_ta[];
+extern const unsigned int gp_tta_tcf_multipleinstance_ta_size;
+
+extern const TEEC_UUID crypt_user_ta_uuid;
+extern const TEEC_UUID os_test_ta_uuid;
+extern const TEEC_UUID create_fail_test_ta_uuid;
+extern const TEEC_UUID rpc_test_ta_uuid;
+extern const TEEC_UUID sims_test_ta_uuid;
+extern const TEEC_UUID gp_tta_testing_client_api_uuid;
+extern const TEEC_UUID gp_tta_answer_success_to_open_session_invoke_uuid;
+extern const TEEC_UUID gp_tta_answer_error_to_invoke_uuid;
+extern const TEEC_UUID gp_tta_answer_error_to_open_session_uuid;
+extern const TEEC_UUID gp_tta_check_OpenSession_with_4_parameters_uuid;
+extern const TEEC_UUID gp_tta_ds_uuid;
+extern const TEEC_UUID storage_ta_uuid;
+extern const TEEC_UUID enc_fs_key_manager_test_ta_uuid;
+extern const TEEC_UUID ecc_test_ta_uuid;
+extern const TEEC_UUID gp_tta_time_uuid;
+extern char *_device;
+
+#endif /*XTEST_TEST_H*/