Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers crys_poly.h Source File

crys_poly.h

Go to the documentation of this file.
00001 /**************************************************************************************
00002 * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved         *
00003 *                                                                                     *
00004 * This file and the related binary are licensed under the following license:          *
00005 *                                                                                     *
00006 * ARM Object Code and Header Files License, v1.0 Redistribution.                      *
00007 *                                                                                     *
00008 * Redistribution and use of object code, header files, and documentation, without     *
00009 * modification, are permitted provided that the following conditions are met:         *
00010 *                                                                                     *
00011 * 1) Redistributions must reproduce the above copyright notice and the                *
00012 *    following disclaimer in the documentation and/or other materials                 *
00013 *    provided with the distribution.                                                  *
00014 *                                                                                     *
00015 * 2) Unless to the extent explicitly permitted by law, no reverse                     *
00016 *    engineering, decompilation, or disassembly of is permitted.                      *
00017 *                                                                                     *
00018 * 3) Redistribution and use is permitted solely for the purpose of                    *
00019 *    developing or executing applications that are targeted for use                   *
00020 *    on an ARM-based product.                                                         *
00021 *                                                                                     *
00022 * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND                  *
00023 * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT             *
00024 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT,        *
00025 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          *
00026 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   *
00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED            *
00028 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR              *
00029 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF              *
00030 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING                *
00031 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS                  *
00032 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                        *
00033 **************************************************************************************/
00034 
00035 
00036 /*!
00037 @file
00038 @brief This file contains all of the enums and definitions that are used for the
00039        CRYS POLY APIs, as well as the APIs themselves.
00040 @defgroup crys_poly CryptoCell POLY APIs
00041 @{
00042 @ingroup cryptocell_api
00043 
00044 */
00045 #ifndef CRYS_POLY_H
00046 #define CRYS_POLY_H
00047 
00048 
00049 #include "ssi_pal_types.h"
00050 #include "crys_error.h"
00051 
00052 
00053 #ifdef __cplusplus
00054 extern "C"
00055 {
00056 #endif
00057 
00058 /************************ Defines ******************************/
00059 /*! POLY KEY size in words. */
00060 #define CRYS_POLY_KEY_SIZE_IN_WORDS     8
00061 /*! POLY KEY size in bytes. */
00062 #define CRYS_POLY_KEY_SIZE_IN_BYTES     (CRYS_POLY_KEY_SIZE_IN_WORDS*SASI_32BIT_WORD_SIZE)
00063 
00064 /*! POLY MAC size in words. */
00065 #define CRYS_POLY_MAC_SIZE_IN_WORDS     4
00066 /*! POLY MAC size in bytes. */
00067 #define CRYS_POLY_MAC_SIZE_IN_BYTES     (CRYS_POLY_MAC_SIZE_IN_WORDS*SASI_32BIT_WORD_SIZE)
00068 
00069 /************************ Typedefs  ****************************/
00070 
00071 /*! CHACHA MAC buffer definition. */
00072 typedef uint32_t CRYS_POLY_Mac_t [CRYS_POLY_MAC_SIZE_IN_WORDS];
00073 
00074 /*! CHACHA key buffer definition. */
00075 typedef uint32_t CRYS_POLY_Key_t [CRYS_POLY_KEY_SIZE_IN_WORDS];
00076 
00077 /************************ Public Functions **********************/
00078 
00079 /****************************************************************************************************/
00080 /*!
00081 @brief This function is used to perform the POLY MAC Calculation.
00082 
00083 @return CRYS_OK on success.
00084 @return A non-zero value on failure as defined crys_poly_error.h.
00085 */
00086 CIMPORT_C CRYSError_t   CRYS_POLY(
00087                             CRYS_POLY_Key_t       pKey,            /*!< [in] A pointer to the user's key buffer. */
00088                 uint8_t              *pDataIn,        /*!< [in] A pointer to the buffer of the input data to the CHACHA.
00089                                                                              must not be null. */
00090                             size_t                dataInSize,      /*!< [in]  The size of the input data. must not be 0. */
00091                 CRYS_POLY_Mac_t   macRes       /*!< [in/out] Pointer to the MAC result buffer.*/
00092 );
00093 
00094 
00095 
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 /**
00100 @}
00101  */
00102 #endif /* #ifndef CRYS_POLY_H */
00103 
00104 
00105 
00106 
00107