00001 00008 /* 00009 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 00010 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 00011 * 00012 * This file is provided under the Apache License 2.0, or the 00013 * GNU General Public License v2.0 or later. 00014 * 00015 * ********** 00016 * Apache License 2.0: 00017 * 00018 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00019 * not use this file except in compliance with the License. 00020 * You may obtain a copy of the License at 00021 * 00022 * http://www.apache.org/licenses/LICENSE-2.0 00023 * 00024 * Unless required by applicable law or agreed to in writing, software 00025 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00026 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00027 * See the License for the specific language governing permissions and 00028 * limitations under the License. 00029 * 00030 * ********** 00031 * 00032 * ********** 00033 * GNU General Public License v2.0 or later: 00034 * 00035 * This program is free software; you can redistribute it and/or modify 00036 * it under the terms of the GNU General Public License as published by 00037 * the Free Software Foundation; either version 2 of the License, or 00038 * (at your option) any later version. 00039 * 00040 * This program is distributed in the hope that it will be useful, 00041 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00042 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00043 * GNU General Public License for more details. 00044 * 00045 * You should have received a copy of the GNU General Public License along 00046 * with this program; if not, write to the Free Software Foundation, Inc., 00047 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00048 * 00049 * ********** 00050 * 00051 * This file is part of mbed TLS (https://tls.mbed.org) 00052 */ 00053 #ifndef MBEDTLS_PKCS5_H 00054 #define MBEDTLS_PKCS5_H 00055 00056 #if !defined(MBEDTLS_CONFIG_FILE) 00057 #include "config.h" 00058 #else 00059 #include MBEDTLS_CONFIG_FILE 00060 #endif 00061 00062 #include "asn1.h" 00063 #include "md.h" 00064 00065 #include <stddef.h> 00066 #include <stdint.h> 00067 00068 #define MBEDTLS_ERR_PKCS5_BAD_INPUT_DATA -0x2f80 00069 #define MBEDTLS_ERR_PKCS5_INVALID_FORMAT -0x2f00 00070 #define MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE -0x2e80 00071 #define MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH -0x2e00 00073 #define MBEDTLS_PKCS5_DECRYPT 0 00074 #define MBEDTLS_PKCS5_ENCRYPT 1 00075 00076 #ifdef __cplusplus 00077 extern "C" { 00078 #endif 00079 00080 #if defined(MBEDTLS_ASN1_PARSE_C) 00081 00095 int mbedtls_pkcs5_pbes2( const mbedtls_asn1_buf *pbe_params, int mode, 00096 const unsigned char *pwd, size_t pwdlen, 00097 const unsigned char *data, size_t datalen, 00098 unsigned char *output ); 00099 00100 #endif /* MBEDTLS_ASN1_PARSE_C */ 00101 00116 int mbedtls_pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx, const unsigned char *password, 00117 size_t plen, const unsigned char *salt, size_t slen, 00118 unsigned int iteration_count, 00119 uint32_t key_length, unsigned char *output ); 00120 00126 int mbedtls_pkcs5_self_test( int verbose ); 00127 00128 #ifdef __cplusplus 00129 } 00130 #endif 00131 00132 #endif /* pkcs5.h */