Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
cipher_internal.h
00001 /** 00002 * \file cipher_internal.h 00003 * 00004 * \brief Cipher wrappers. 00005 * 00006 * \author Adriaan de Jong <dejong@fox-it.com> 00007 */ 00008 /* 00009 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 00010 * SPDX-License-Identifier: Apache-2.0 00011 * 00012 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00013 * not use this file except in compliance with the License. 00014 * You may obtain a copy of the License at 00015 * 00016 * http://www.apache.org/licenses/LICENSE-2.0 00017 * 00018 * Unless required by applicable law or agreed to in writing, software 00019 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00020 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00021 * See the License for the specific language governing permissions and 00022 * limitations under the License. 00023 * 00024 * This file is part of mbed TLS (https://tls.mbed.org) 00025 */ 00026 #ifndef MBEDTLS_CIPHER_WRAP_H 00027 #define MBEDTLS_CIPHER_WRAP_H 00028 00029 #if !defined(MBEDTLS_CONFIG_FILE) 00030 #include "config.h" 00031 #else 00032 #include MBEDTLS_CONFIG_FILE 00033 #endif 00034 00035 #include "cipher.h" 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 /** 00042 * Base cipher information. The non-mode specific functions and values. 00043 */ 00044 struct mbedtls_cipher_base_t 00045 { 00046 /** Base Cipher type (e.g. MBEDTLS_CIPHER_ID_AES) */ 00047 mbedtls_cipher_id_t cipher; 00048 00049 /** Encrypt using ECB */ 00050 int (*ecb_func)( void *ctx, mbedtls_operation_t mode, 00051 const unsigned char *input, unsigned char *output ); 00052 00053 #if defined(MBEDTLS_CIPHER_MODE_CBC) 00054 /** Encrypt using CBC */ 00055 int (*cbc_func)( void *ctx, mbedtls_operation_t mode, size_t length, 00056 unsigned char *iv, const unsigned char *input, 00057 unsigned char *output ); 00058 #endif 00059 00060 #if defined(MBEDTLS_CIPHER_MODE_CFB) 00061 /** Encrypt using CFB (Full length) */ 00062 int (*cfb_func)( void *ctx, mbedtls_operation_t mode, size_t length, size_t *iv_off, 00063 unsigned char *iv, const unsigned char *input, 00064 unsigned char *output ); 00065 #endif 00066 00067 #if defined(MBEDTLS_CIPHER_MODE_CTR) 00068 /** Encrypt using CTR */ 00069 int (*ctr_func)( void *ctx, size_t length, size_t *nc_off, 00070 unsigned char *nonce_counter, unsigned char *stream_block, 00071 const unsigned char *input, unsigned char *output ); 00072 #endif 00073 00074 #if defined(MBEDTLS_CIPHER_MODE_STREAM) 00075 /** Encrypt using STREAM */ 00076 int (*stream_func)( void *ctx, size_t length, 00077 const unsigned char *input, unsigned char *output ); 00078 #endif 00079 00080 /** Set key for encryption purposes */ 00081 int (*setkey_enc_func)( void *ctx, const unsigned char *key, 00082 unsigned int key_bitlen ); 00083 00084 /** Set key for decryption purposes */ 00085 int (*setkey_dec_func)( void *ctx, const unsigned char *key, 00086 unsigned int key_bitlen); 00087 00088 /** Allocate a new context */ 00089 void * (*ctx_alloc_func)( void ); 00090 00091 /** Free the given context */ 00092 void (*ctx_free_func)( void *ctx ); 00093 00094 }; 00095 00096 typedef struct 00097 { 00098 mbedtls_cipher_type_t type; 00099 const mbedtls_cipher_info_t *info; 00100 } mbedtls_cipher_definition_t; 00101 00102 extern const mbedtls_cipher_definition_t mbedtls_cipher_definitions[]; 00103 00104 extern int mbedtls_cipher_supported[]; 00105 00106 #ifdef __cplusplus 00107 } 00108 #endif 00109 00110 #endif /* MBEDTLS_CIPHER_WRAP_H */
Generated on Tue Jul 12 2022 12:21:46 by
