aes.h | aes.h | |||
---|---|---|---|---|
/** | /** | |||
* \file aes.h | * \file aes.h | |||
* | * | |||
* \brief AES block cipher | * \brief AES block cipher | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_AES_H | #ifndef POLARSSL_AES_H | |||
#define POLARSSL_AES_H | #define POLARSSL_AES_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define AES_ENCRYPT 1 | #define AES_ENCRYPT 1 | |||
#define AES_DECRYPT 0 | #define AES_DECRYPT 0 | |||
#define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< In valid key length. */ | #define POLARSSL_ERR_AES_INVALID_KEY_LENGTH -0x0020 /**< In valid key length. */ | |||
#define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< In valid data input length. */ | #define POLARSSL_ERR_AES_INVALID_INPUT_LENGTH -0x0022 /**< In valid data input length. */ | |||
#if !defined(POLARSSL_AES_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief AES context structure | * \brief AES context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
int nr; /*!< number of rounds */ | int nr; /*!< number of rounds */ | |||
uint32_t *rk; /*!< AES round keys */ | uint32_t *rk; /*!< AES round keys */ | |||
uint32_t buf[68]; /*!< unaligned data */ | uint32_t buf[68]; /*!< unaligned data */ | |||
} | } | |||
aes_context; | aes_context; | |||
skipping to change at line 172 | skipping to change at line 178 | |||
* | * | |||
* \return 0 if successful | * \return 0 if successful | |||
*/ | */ | |||
int aes_crypt_ctr( aes_context *ctx, | int aes_crypt_ctr( aes_context *ctx, | |||
size_t length, | size_t length, | |||
size_t *nc_off, | size_t *nc_off, | |||
unsigned char nonce_counter[16], | unsigned char nonce_counter[16], | |||
unsigned char stream_block[16], | unsigned char stream_block[16], | |||
const unsigned char *input, | const unsigned char *input, | |||
unsigned char *output ); | unsigned char *output ); | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_AES_ALT */ | ||||
#include "aes_alt.h" | ||||
#endif /* POLARSSL_AES_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int aes_self_test( int verbose ); | int aes_self_test( int verbose ); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 20 lines changed or added | |||
arc4.h | arc4.h | |||
---|---|---|---|---|
/** | /** | |||
* \file arc4.h | * \file arc4.h | |||
* | * | |||
* \brief The ARCFOUR stream cipher | * \brief The ARCFOUR stream cipher | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_ARC4_H | #ifndef POLARSSL_ARC4_H | |||
#define POLARSSL_ARC4_H | #define POLARSSL_ARC4_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#if !defined(POLARSSL_ARC4_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief ARC4 context structure | * \brief ARC4 context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
int x; /*!< permutation index */ | int x; /*!< permutation index */ | |||
int y; /*!< permutation index */ | int y; /*!< permutation index */ | |||
unsigned char m[256]; /*!< permutation table */ | unsigned char m[256]; /*!< permutation table */ | |||
} | } | |||
arc4_context; | arc4_context; | |||
skipping to change at line 69 | skipping to change at line 75 | |||
* \param ctx ARC4 context | * \param ctx ARC4 context | |||
* \param length length of the input data | * \param length length of the input data | |||
* \param input buffer holding the input data | * \param input buffer holding the input data | |||
* \param output buffer for the output data | * \param output buffer for the output data | |||
* | * | |||
* \return 0 if successful | * \return 0 if successful | |||
*/ | */ | |||
int arc4_crypt( arc4_context *ctx, size_t length, const unsigned char *inpu t, | int arc4_crypt( arc4_context *ctx, size_t length, const unsigned char *inpu t, | |||
unsigned char *output ); | unsigned char *output ); | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_ARC4_ALT */ | ||||
#include "arc4_alt.h" | ||||
#endif /* POLARSSL_ARC4_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int arc4_self_test( int verbose ); | int arc4_self_test( int verbose ); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||
bignum.h | bignum.h | |||
---|---|---|---|---|
/** | /** | |||
* \file bignum.h | * \file bignum.h | |||
* | * | |||
* \brief Multi-precision integer library | * \brief Multi-precision integer library | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 68 | skipping to change at line 68 | |||
#define POLARSSL_ERR_MPI_NOT_ACCEPTABLE -0x000E /**< Th e input arguments are not acceptable. */ | #define POLARSSL_ERR_MPI_NOT_ACCEPTABLE -0x000E /**< Th e input arguments are not acceptable. */ | |||
#define POLARSSL_ERR_MPI_MALLOC_FAILED -0x0010 /**< Me mory allocation failed. */ | #define POLARSSL_ERR_MPI_MALLOC_FAILED -0x0010 /**< Me mory allocation failed. */ | |||
#define MPI_CHK(f) if( ( ret = f ) != 0 ) goto cleanup | #define MPI_CHK(f) if( ( ret = f ) != 0 ) goto cleanup | |||
/* | /* | |||
* Maximum size MPIs are allowed to grow to in number of limbs. | * Maximum size MPIs are allowed to grow to in number of limbs. | |||
*/ | */ | |||
#define POLARSSL_MPI_MAX_LIMBS 10000 | #define POLARSSL_MPI_MAX_LIMBS 10000 | |||
#if !defined(POLARSSL_CONFIG_OPTIONS) | ||||
/* | /* | |||
* Maximum window size used for modular exponentiation. Default: 6 | * Maximum window size used for modular exponentiation. Default: 6 | |||
* Minimum value: 1. Maximum value: 6. | * Minimum value: 1. Maximum value: 6. | |||
* | * | |||
* Result is an array of ( 2 << POLARSSL_MPI_WINDOW_SIZE ) MPIs used | * Result is an array of ( 2 << POLARSSL_MPI_WINDOW_SIZE ) MPIs used | |||
* for the sliding window calculation. (So 64 by default) | * for the sliding window calculation. (So 64 by default) | |||
* | * | |||
* Reduction in size, reduces speed. | * Reduction in size, reduces speed. | |||
*/ | */ | |||
#define POLARSSL_MPI_WINDOW_SIZE 6 /**< Ma ximum windows size used. */ | #define POLARSSL_MPI_WINDOW_SIZE 6 /**< Ma ximum windows size used. */ | |||
/* | /* | |||
* Maximum size of MPIs allowed in bits and bytes for user-MPIs. | * Maximum size of MPIs allowed in bits and bytes for user-MPIs. | |||
* ( Default: 512 bytes => 4096 bits, Maximum tested: 2048 bytes => 16384 b its ) | * ( Default: 512 bytes => 4096 bits, Maximum tested: 2048 bytes => 16384 b its ) | |||
* | * | |||
* Note: Calculations can results temporarily in larger MPIs. So the number | * Note: Calculations can results temporarily in larger MPIs. So the number | |||
* of limbs required (POLARSSL_MPI_MAX_LIMBS) is higher. | * of limbs required (POLARSSL_MPI_MAX_LIMBS) is higher. | |||
*/ | */ | |||
#define POLARSSL_MPI_MAX_SIZE 512 /**< Ma ximum number of bytes for usable MPIs. */ | #define POLARSSL_MPI_MAX_SIZE 512 /**< Ma ximum number of bytes for usable MPIs. */ | |||
#endif /* !POLARSSL_CONFIG_OPTIONS */ | ||||
#define POLARSSL_MPI_MAX_BITS ( 8 * POLARSSL_M PI_MAX_SIZE ) /**< Maximum number of bits for usable MPIs. */ | #define POLARSSL_MPI_MAX_BITS ( 8 * POLARSSL_M PI_MAX_SIZE ) /**< Maximum number of bits for usable MPIs. */ | |||
/* | /* | |||
* When reading from files with mpi_read_file() and writing to files with | * When reading from files with mpi_read_file() and writing to files with | |||
* mpi_write_file() the buffer should have space | * mpi_write_file() the buffer should have space | |||
* for a (short) label, the MPI (in the provided radix), the newline | * for a (short) label, the MPI (in the provided radix), the newline | |||
* characters and the '\0'. | * characters and the '\0'. | |||
* | * | |||
* By default we assume at least a 10 char label, a minimum radix of 10 | * By default we assume at least a 10 char label, a minimum radix of 10 | |||
* (decimal) and a maximum of 4096 bit numbers (1234 decimal chars). | * (decimal) and a maximum of 4096 bit numbers (1234 decimal chars). | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
blowfish.h | blowfish.h | |||
---|---|---|---|---|
/** | /** | |||
* \file blowfish.h | * \file blowfish.h | |||
* | * | |||
* \brief Blowfish block cipher | * \brief Blowfish block cipher | |||
* | * | |||
* Copyright (C) 2012-2012, Brainspark B.V. | * Copyright (C) 2012-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_BLOWFISH_H | #ifndef POLARSSL_BLOWFISH_H | |||
#define POLARSSL_BLOWFISH_H | #define POLARSSL_BLOWFISH_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define BLOWFISH_ENCRYPT 1 | #define BLOWFISH_ENCRYPT 1 | |||
#define BLOWFISH_DECRYPT 0 | #define BLOWFISH_DECRYPT 0 | |||
#define BLOWFISH_MAX_KEY 448 | #define BLOWFISH_MAX_KEY 448 | |||
#define BLOWFISH_MIN_KEY 32 | #define BLOWFISH_MIN_KEY 32 | |||
#define BLOWFISH_ROUNDS 16 /* when increasing this value, make sure to extend the initialisation vectors */ | #define BLOWFISH_ROUNDS 16 /* when increasing this value, make sure to extend the initialisation vectors */ | |||
#define BLOWFISH_BLOCKSIZE 8 /* Blowfish uses 64 bit blocks */ | #define BLOWFISH_BLOCKSIZE 8 /* Blowfish uses 64 bit blocks */ | |||
#define POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH -0x0016 /* *< Invalid key length. */ | #define POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH -0x0016 /* *< Invalid key length. */ | |||
#define POLARSSL_ERR_BLOWFISH_INVALID_INPUT_LENGTH -0x0018 /* *< Invalid data input length. */ | #define POLARSSL_ERR_BLOWFISH_INVALID_INPUT_LENGTH -0x0018 /* *< Invalid data input length. */ | |||
#if !defined(POLARSSL_BLOWFISH_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief Blowfish context structure | * \brief Blowfish context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
uint32_t P[BLOWFISH_ROUNDS + 2]; /*!< Blowfish round keys */ | uint32_t P[BLOWFISH_ROUNDS + 2]; /*!< Blowfish round keys */ | |||
uint32_t S[4][256]; /*!< key dependent S-boxes */ | uint32_t S[4][256]; /*!< key dependent S-boxes */ | |||
} | } | |||
blowfish_context; | blowfish_context; | |||
skipping to change at line 161 | skipping to change at line 167 | |||
size_t *nc_off, | size_t *nc_off, | |||
unsigned char nonce_counter[BLOWFISH_BLOCKSIZE], | unsigned char nonce_counter[BLOWFISH_BLOCKSIZE], | |||
unsigned char stream_block[BLOWFISH_BLOCKSIZE], | unsigned char stream_block[BLOWFISH_BLOCKSIZE], | |||
const unsigned char *input, | const unsigned char *input, | |||
unsigned char *output ); | unsigned char *output ); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#else /* POLARSSL_BLOWFISH_ALT */ | ||||
#include "blowfish_alt.h" | ||||
#endif /* POLARSSL_BLOWFISH_ALT */ | ||||
#endif /* blowfish.h */ | #endif /* blowfish.h */ | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 11 lines changed or added | |||
bn_mul.h | bn_mul.h | |||
---|---|---|---|---|
skipping to change at line 551 | skipping to change at line 551 | |||
#define MULADDC_STOP \ | #define MULADDC_STOP \ | |||
asm( "st.w %0, %%d4 " : "=m" (c)); \ | asm( "st.w %0, %%d4 " : "=m" (c)); \ | |||
asm( "st.a %0, %%a3 " : "=m" (d)); \ | asm( "st.a %0, %%a3 " : "=m" (d)); \ | |||
asm( "st.a %0, %%a2 " : "=m" (s) :: \ | asm( "st.a %0, %%a2 " : "=m" (s) :: \ | |||
"d0", "d1", "e2", "d4", "a2", "a3" ); | "d0", "d1", "e2", "d4", "a2", "a3" ); | |||
#endif /* TriCore */ | #endif /* TriCore */ | |||
#if defined(__arm__) | #if defined(__arm__) | |||
#if defined(__thumb__) | #if defined(__thumb__) && !defined(__thumb2__) | |||
#define MULADDC_INIT \ | #define MULADDC_INIT \ | |||
asm( \ | asm( \ | |||
" \ | " \ | |||
ldr r0, %3; \ | ldr r0, %3; \ | |||
ldr r1, %4; \ | ldr r1, %4; \ | |||
ldr r2, %5; \ | ldr r2, %5; \ | |||
ldr r3, %6; \ | ldr r3, %6; \ | |||
lsr r7, r3, #16; \ | lsr r7, r3, #16; \ | |||
mov r9, r7; \ | mov r9, r7; \ | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
camellia.h | camellia.h | |||
---|---|---|---|---|
/** | /** | |||
* \file camellia.h | * \file camellia.h | |||
* | * | |||
* \brief Camellia block cipher | * \brief Camellia block cipher | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_CAMELLIA_H | #ifndef POLARSSL_CAMELLIA_H | |||
#define POLARSSL_CAMELLIA_H | #define POLARSSL_CAMELLIA_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define CAMELLIA_ENCRYPT 1 | #define CAMELLIA_ENCRYPT 1 | |||
#define CAMELLIA_DECRYPT 0 | #define CAMELLIA_DECRYPT 0 | |||
#define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024 /**< In valid key length. */ | #define POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH -0x0024 /**< In valid key length. */ | |||
#define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 /**< In valid data input length. */ | #define POLARSSL_ERR_CAMELLIA_INVALID_INPUT_LENGTH -0x0026 /**< In valid data input length. */ | |||
#if !defined(POLARSSL_CAMELLIA_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief CAMELLIA context structure | * \brief CAMELLIA context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
int nr; /*!< number of rounds */ | int nr; /*!< number of rounds */ | |||
uint32_t rk[68]; /*!< CAMELLIA round keys */ | uint32_t rk[68]; /*!< CAMELLIA round keys */ | |||
} | } | |||
camellia_context; | camellia_context; | |||
skipping to change at line 171 | skipping to change at line 177 | |||
* \return 0 if successful | * \return 0 if successful | |||
*/ | */ | |||
int camellia_crypt_ctr( camellia_context *ctx, | int camellia_crypt_ctr( camellia_context *ctx, | |||
size_t length, | size_t length, | |||
size_t *nc_off, | size_t *nc_off, | |||
unsigned char nonce_counter[16], | unsigned char nonce_counter[16], | |||
unsigned char stream_block[16], | unsigned char stream_block[16], | |||
const unsigned char *input, | const unsigned char *input, | |||
unsigned char *output ); | unsigned char *output ); | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_CAMELLIA_ALT */ | ||||
#include "camellia_alt.h" | ||||
#endif /* POLARSSL_CAMELLIA_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int camellia_self_test( int verbose ); | int camellia_self_test( int verbose ); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||
config.h | config.h | |||
---|---|---|---|---|
/** | /** | |||
* \file config.h | * \file config.h | |||
* | * | |||
* \brief Configuration options (set of defines) | * \brief Configuration options (set of defines) | |||
* | * | |||
* Copyright (C) 2006-2012, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 108 | skipping to change at line 108 | |||
/** | /** | |||
* \name SECTION: PolarSSL feature support | * \name SECTION: PolarSSL feature support | |||
* | * | |||
* This section sets support for features that are or are not needed | * This section sets support for features that are or are not needed | |||
* within the modules that are enabled. | * within the modules that are enabled. | |||
* \{ | * \{ | |||
*/ | */ | |||
/** | /** | |||
* \def POLARSSL_XXX_ALT | ||||
* | ||||
* Uncomment a macro to let PolarSSL use your alternate core implementation | ||||
of | ||||
* a symmetric or hash algorithm (e.g. platform specific assembly optimized | ||||
* implementations). Keep in mind that the function prototypes should remai | ||||
n | ||||
* the same. | ||||
* | ||||
* Example: In case you uncomment POLARSSL_AES_ALT, PolarSSL will no longer | ||||
* provide the "struct aes_context" definition and omit the base function | ||||
* declarations and implementations. "aes_alt.h" will be included from | ||||
* "aes.h" to include the new function definitions. | ||||
* | ||||
* Uncomment a macro to enable alternate implementation for core algorithm | ||||
* functions | ||||
#define POLARSSL_AES_ALT | ||||
#define POLARSSL_ARC4_ALT | ||||
#define POLARSSL_BLOWFISH_ALT | ||||
#define POLARSSL_CAMELLIA_ALT | ||||
#define POLARSSL_DES_ALT | ||||
#define POLARSSL_XTEA_ALT | ||||
#define POLARSSL_MD2_ALT | ||||
#define POLARSSL_MD4_ALT | ||||
#define POLARSSL_MD5_ALT | ||||
#define POLARSSL_SHA1_ALT | ||||
#define POLARSSL_SHA2_ALT | ||||
#define POLARSSL_SHA4_ALT | ||||
*/ | ||||
/** | ||||
* \def POLARSSL_AES_ROM_TABLES | * \def POLARSSL_AES_ROM_TABLES | |||
* | * | |||
* Store the AES tables in ROM. | * Store the AES tables in ROM. | |||
* | * | |||
* Uncomment this macro to store the AES tables in ROM. | * Uncomment this macro to store the AES tables in ROM. | |||
* | * | |||
#define POLARSSL_AES_ROM_TABLES | #define POLARSSL_AES_ROM_TABLES | |||
*/ | */ | |||
/** | /** | |||
skipping to change at line 586 | skipping to change at line 615 | |||
* TLS_RSA_WITH_AES_128_GCM_SHA256 | * TLS_RSA_WITH_AES_128_GCM_SHA256 | |||
* TLS_RSA_WITH_AES_256_GCM_SHA384 | * TLS_RSA_WITH_AES_256_GCM_SHA384 | |||
*/ | */ | |||
#define POLARSSL_GCM_C | #define POLARSSL_GCM_C | |||
/** | /** | |||
* \def POLARSSL_HAVEGE_C | * \def POLARSSL_HAVEGE_C | |||
* | * | |||
* Enable the HAVEGE random generator. | * Enable the HAVEGE random generator. | |||
* | * | |||
* Warning: the HAVEGE random generator is not suitable for virtualized | ||||
* environments | ||||
* | ||||
* Warning: the HAVEGE random generator is dependent on timing and specific | ||||
* processor traits. It is therefore not advised to use HAVEGE as | ||||
* your applications primary random generator or primary entropy p | ||||
ool | ||||
* input. As a secondary input to your entropy pool, it IS able ad | ||||
d | ||||
* the (limited) extra entropy it provides. | ||||
* | ||||
* Module: library/havege.c | * Module: library/havege.c | |||
* Caller: | * Caller: | |||
* | * | |||
* Requires: POLARSSL_TIMING_C | * Requires: POLARSSL_TIMING_C | |||
* | * | |||
* This module enables the HAVEGE random number generator. | * Uncomment to enable the HAVEGE random generator. | |||
*/ | ||||
#define POLARSSL_HAVEGE_C | #define POLARSSL_HAVEGE_C | |||
*/ | ||||
/** | /** | |||
* \def POLARSSL_MD_C | * \def POLARSSL_MD_C | |||
* | * | |||
* Enable the generic message digest layer. | * Enable the generic message digest layer. | |||
* | * | |||
* Module: library/md.c | * Module: library/md.c | |||
* Caller: | * Caller: | |||
* | * | |||
* Uncomment to enable generic message digest wrappers. | * Uncomment to enable generic message digest wrappers. | |||
skipping to change at line 676 | skipping to change at line 714 | |||
* Caller: library/aes.c | * Caller: library/aes.c | |||
* | * | |||
* This modules adds support for the VIA PadLock on x86. | * This modules adds support for the VIA PadLock on x86. | |||
*/ | */ | |||
#define POLARSSL_PADLOCK_C | #define POLARSSL_PADLOCK_C | |||
/** | /** | |||
* \def POLARSSL_PBKDF2_C | * \def POLARSSL_PBKDF2_C | |||
* | * | |||
* Enable PKCS#5 PBKDF2 key derivation function | * Enable PKCS#5 PBKDF2 key derivation function | |||
* DEPRECATED: Use POLARSSL_PKCS5_C instead | ||||
* | * | |||
* Module: library/pbkdf2.c | * Module: library/pbkdf2.c | |||
* | * | |||
* Requires: POLARSSL_MD_C | * Requires: POLARSSL_PKCS5_C | |||
* | * | |||
* This module adds support for the PKCS#5 PBKDF2 key derivation function. | * This module adds support for the PKCS#5 PBKDF2 key derivation function. | |||
#define POLARSSL_PBKDF2_C | #define POLARSSL_PBKDF2_C | |||
*/ | */ | |||
/** | /** | |||
* \def POLARSSL_PEM_C | * \def POLARSSL_PEM_C | |||
* | * | |||
* Enable PEM decoding | * Enable PEM decoding | |||
* | * | |||
* Module: library/pem.c | * Module: library/pem.c | |||
* Caller: library/x509parse.c | * Caller: library/x509parse.c | |||
* | * | |||
* Requires: POLARSSL_BASE64_C | * Requires: POLARSSL_BASE64_C | |||
* | * | |||
* This modules adds support for decoding PEM files. | * This modules adds support for decoding PEM files. | |||
*/ | */ | |||
#define POLARSSL_PEM_C | #define POLARSSL_PEM_C | |||
/** | /** | |||
* \def POLARSSL_PKCS5_C | ||||
* | ||||
* Enable PKCS#5 functions | ||||
* | ||||
* Module: library/pkcs5.c | ||||
* | ||||
* Requires: POLARSSL_MD_C | ||||
* | ||||
* This module adds support for the PKCS#5 functions. | ||||
*/ | ||||
#define POLARSSL_PKCS5_C | ||||
/** | ||||
* \def POLARSSL_PKCS11_C | * \def POLARSSL_PKCS11_C | |||
* | * | |||
* Enable wrapper for PKCS#11 smartcard support. | * Enable wrapper for PKCS#11 smartcard support. | |||
* | * | |||
* Module: library/ssl_srv.c | * Module: library/ssl_srv.c | |||
* Caller: library/ssl_cli.c | * Caller: library/ssl_cli.c | |||
* library/ssl_srv.c | * library/ssl_srv.c | |||
* | * | |||
* Requires: POLARSSL_SSL_TLS_C | * Requires: POLARSSL_SSL_TLS_C | |||
* | * | |||
* This module enables SSL/TLS PKCS #11 smartcard support. | * This module enables SSL/TLS PKCS #11 smartcard support. | |||
* Requires the presence of the PKCS#11 helper library (libpkcs11-helper) | * Requires the presence of the PKCS#11 helper library (libpkcs11-helper) | |||
#define POLARSSL_PKCS11_C | #define POLARSSL_PKCS11_C | |||
*/ | */ | |||
/** | /** | |||
* \def POLARSSL_PKCS12_C | ||||
* | ||||
* Enable PKCS#12 PBE functions | ||||
* Adds algorithms for parsing PKCS#8 encrypted private keys | ||||
* | ||||
* Module: library/pkcs12.c | ||||
* Caller: library/x509parse.c | ||||
* | ||||
* Requires: POLARSSL_ASN1_PARSE_C, POLARSSL_CIPHER_C, POLARSSL_MD_C | ||||
* Can use: POLARSSL_ARC4_C | ||||
* | ||||
* This module enables PKCS#12 functions. | ||||
*/ | ||||
#define POLARSSL_PKCS12_C | ||||
/** | ||||
* \def POLARSSL_RSA_C | * \def POLARSSL_RSA_C | |||
* | * | |||
* Enable the RSA public-key cryptosystem. | * Enable the RSA public-key cryptosystem. | |||
* | * | |||
* Module: library/rsa.c | * Module: library/rsa.c | |||
* Caller: library/ssl_cli.c | * Caller: library/ssl_cli.c | |||
* library/ssl_srv.c | * library/ssl_srv.c | |||
* library/ssl_tls.c | * library/ssl_tls.c | |||
* library/x509.c | * library/x509.c | |||
* | * | |||
skipping to change at line 892 | skipping to change at line 960 | |||
* \def POLARSSL_XTEA_C | * \def POLARSSL_XTEA_C | |||
* | * | |||
* Enable the XTEA block cipher. | * Enable the XTEA block cipher. | |||
* | * | |||
* Module: library/xtea.c | * Module: library/xtea.c | |||
* Caller: | * Caller: | |||
*/ | */ | |||
#define POLARSSL_XTEA_C | #define POLARSSL_XTEA_C | |||
/* \} name */ | /* \} name */ | |||
/** | ||||
* \name SECTION: Module configuration options | ||||
* | ||||
* This section allows for the setting of module specific sizes and | ||||
* configuration options. The default values are already present in the | ||||
* relevant header files and should suffice for the regular use cases. | ||||
* Our advice is to enable POLARSSL_CONFIG_OPTIONS and change values here | ||||
* only if you have a good reason and know the consequences. | ||||
* | ||||
* If POLARSSL_CONFIG_OPTIONS is undefined here the options in the module | ||||
* header file take precedence. | ||||
* | ||||
* Please check the respective header file for documentation on these | ||||
* parameters (to prevent duplicate documentation). | ||||
* | ||||
* Uncomment POLARSSL_CONFIG_OPTIONS to enable using the values defined her | ||||
e. | ||||
* \{ | ||||
*/ | ||||
//#define POLARSSL_CONFIG_OPTIONS /**< Enable config.h module value confi | ||||
guration */ | ||||
#if defined(POLARSSL_CONFIG_OPTIONS) | ||||
// MPI / BIGNUM options | ||||
// | ||||
#define POLARSSL_MPI_WINDOW_SIZE 6 /**< Maximum windows size use | ||||
d. */ | ||||
#define POLARSSL_MPI_MAX_SIZE 512 /**< Maximum number of bytes | ||||
for usable MPIs. */ | ||||
// CTR_DRBG options | ||||
// | ||||
#define CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used p | ||||
er seed by default */ | ||||
#define CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed i | ||||
s performed by default */ | ||||
#define CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additi | ||||
onal input bytes */ | ||||
#define CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of reques | ||||
ted bytes per call */ | ||||
#define CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed | ||||
buffer */ | ||||
// Entropy options | ||||
// | ||||
#define ENTROPY_MAX_SOURCES 20 /**< Maximum number of source | ||||
s supported */ | ||||
#define ENTROPY_MAX_GATHER 128 /**< Maximum amount requested | ||||
from entropy sources */ | ||||
// SSL Cache options | ||||
// | ||||
#define SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */ | ||||
#define SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache | ||||
*/ | ||||
// SSL options | ||||
// | ||||
#define SSL_MAX_CONTENT_LEN 16384 /**< Size of the input / outp | ||||
ut buffer */ | ||||
#endif /* POLARSSL_CONFIG_OPTIONS */ | ||||
/* \} name */ | ||||
#endif /* config.h */ | #endif /* config.h */ | |||
End of changes. 10 change blocks. | ||||
4 lines changed or deleted | 141 lines changed or added | |||
ctr_drbg.h | ctr_drbg.h | |||
---|---|---|---|---|
/** | /** | |||
* \file ctr_drbg.h | * \file ctr_drbg.h | |||
* | * | |||
* \brief CTR_DRBG based on AES-256 (NIST SP 800-90) | * \brief CTR_DRBG based on AES-256 (NIST SP 800-90) | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 44 | skipping to change at line 44 | |||
#define POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED -0x0034 /**< Th e entropy source failed. */ | #define POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED -0x0034 /**< Th e entropy source failed. */ | |||
#define POLARSSL_ERR_CTR_DRBG_REQUEST_TOO_BIG -0x0036 /**< To o many random requested in single call. */ | #define POLARSSL_ERR_CTR_DRBG_REQUEST_TOO_BIG -0x0036 /**< To o many random requested in single call. */ | |||
#define POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG -0x0038 /**< In put too large (Entropy + additional). */ | #define POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG -0x0038 /**< In put too large (Entropy + additional). */ | |||
#define POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR -0x003A /**< Re ad/write error in file. */ | #define POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR -0x003A /**< Re ad/write error in file. */ | |||
#define CTR_DRBG_BLOCKSIZE 16 /**< Block size used by the cip her */ | #define CTR_DRBG_BLOCKSIZE 16 /**< Block size used by the cip her */ | |||
#define CTR_DRBG_KEYSIZE 32 /**< Key size used by the ciphe r */ | #define CTR_DRBG_KEYSIZE 32 /**< Key size used by the ciphe r */ | |||
#define CTR_DRBG_KEYBITS ( CTR_DRBG_KEYSIZE * 8 ) | #define CTR_DRBG_KEYBITS ( CTR_DRBG_KEYSIZE * 8 ) | |||
#define CTR_DRBG_SEEDLEN ( CTR_DRBG_KEYSIZE + CTR_DRBG_BLOCKSIZE ) | #define CTR_DRBG_SEEDLEN ( CTR_DRBG_KEYSIZE + CTR_DRBG_BLOCKSIZE ) | |||
/**< The seed length (counter + AES key) */ | /**< The seed length (counter + AES key) */ | |||
#define CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per | ||||
seed by default */ | #if !defined(POLARSSL_CONFIG_OPTIONS) | |||
#define CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per | ||||
seed by default */ | ||||
#define CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ | #define CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ | |||
#define CTR_DRBG_MAX_INPUT 256 /**< Maximum number of addition | #define CTR_DRBG_MAX_INPUT 256 /**< Maximum number of addition | |||
al input bytes */ | al input bytes */ | |||
#define CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requeste | #define CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requeste | |||
d bytes per call */ | d bytes per call */ | |||
#define CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed b | #define CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed b | |||
uffer */ | uffer */ | |||
#endif /* !POLARSSL_CONFIG_OPTIONS */ | ||||
#define CTR_DRBG_PR_OFF 0 /**< No prediction resistance */ | #define CTR_DRBG_PR_OFF 0 /**< No prediction resistance */ | |||
#define CTR_DRBG_PR_ON 1 /**< Prediction resistance enab led */ | #define CTR_DRBG_PR_ON 1 /**< Prediction resistance enab led */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* \brief CTR_DRBG context structure | * \brief CTR_DRBG context structure | |||
End of changes. 3 change blocks. | ||||
9 lines changed or deleted | 12 lines changed or added | |||
des.h | des.h | |||
---|---|---|---|---|
/** | /** | |||
* \file des.h | * \file des.h | |||
* | * | |||
* \brief DES block cipher | * \brief DES block cipher | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_DES_H | #ifndef POLARSSL_DES_H | |||
#define POLARSSL_DES_H | #define POLARSSL_DES_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define DES_ENCRYPT 1 | #define DES_ENCRYPT 1 | |||
#define DES_DECRYPT 0 | #define DES_DECRYPT 0 | |||
#define POLARSSL_ERR_DES_INVALID_INPUT_LENGTH -0x0032 /**< Th e data input has an invalid length. */ | #define POLARSSL_ERR_DES_INVALID_INPUT_LENGTH -0x0032 /**< Th e data input has an invalid length. */ | |||
#define DES_KEY_SIZE 8 | #define DES_KEY_SIZE 8 | |||
#if !defined(POLARSSL_DES_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief DES context structure | * \brief DES context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
int mode; /*!< encrypt/decrypt */ | int mode; /*!< encrypt/decrypt */ | |||
uint32_t sk[32]; /*!< DES subkeys */ | uint32_t sk[32]; /*!< DES subkeys */ | |||
} | } | |||
des_context; | des_context; | |||
skipping to change at line 223 | skipping to change at line 229 | |||
* | * | |||
* \return 0 if successful, or POLARSSL_ERR_DES_INVALID_INPUT_LENGT H | * \return 0 if successful, or POLARSSL_ERR_DES_INVALID_INPUT_LENGT H | |||
*/ | */ | |||
int des3_crypt_cbc( des3_context *ctx, | int des3_crypt_cbc( des3_context *ctx, | |||
int mode, | int mode, | |||
size_t length, | size_t length, | |||
unsigned char iv[8], | unsigned char iv[8], | |||
const unsigned char *input, | const unsigned char *input, | |||
unsigned char *output ); | unsigned char *output ); | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_DES_ALT */ | ||||
#include "des_alt.h" | ||||
#endif /* POLARSSL_DES_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int des_self_test( int verbose ); | int des_self_test( int verbose ); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||
entropy.h | entropy.h | |||
---|---|---|---|---|
/** | /** | |||
* \file entropy.h | * \file entropy.h | |||
* | * | |||
* \brief Entropy accumulator implementation | * \brief Entropy accumulator implementation | |||
* | * | |||
* Copyright (C) 2006-2011, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 43 | skipping to change at line 43 | |||
#include "sha4.h" | #include "sha4.h" | |||
#if defined(POLARSSL_HAVEGE_C) | #if defined(POLARSSL_HAVEGE_C) | |||
#include "havege.h" | #include "havege.h" | |||
#endif | #endif | |||
#define POLARSSL_ERR_ENTROPY_SOURCE_FAILED -0x003C /**< Cr itical entropy source failure. */ | #define POLARSSL_ERR_ENTROPY_SOURCE_FAILED -0x003C /**< Cr itical entropy source failure. */ | |||
#define POLARSSL_ERR_ENTROPY_MAX_SOURCES -0x003E /**< No more sources can be added. */ | #define POLARSSL_ERR_ENTROPY_MAX_SOURCES -0x003E /**< No more sources can be added. */ | |||
#define POLARSSL_ERR_ENTROPY_NO_SOURCES_DEFINED -0x0040 /**< No sources have been added to poll. */ | #define POLARSSL_ERR_ENTROPY_NO_SOURCES_DEFINED -0x0040 /**< No sources have been added to poll. */ | |||
#if !defined(POLARSSL_CONFIG_OPTIONS) | ||||
#define ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supp orted */ | #define ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supp orted */ | |||
#define ENTROPY_MAX_GATHER 128 /**< Maximum amount requested from entropy sources */ | #define ENTROPY_MAX_GATHER 128 /**< Maximum amount requested from entropy sources */ | |||
#endif /* !POLARSSL_CONFIG_OPTIONS */ | ||||
#define ENTROPY_BLOCK_SIZE 64 /**< Block size of entropy accumula tor (SHA-512) */ | #define ENTROPY_BLOCK_SIZE 64 /**< Block size of entropy accumula tor (SHA-512) */ | |||
#define ENTROPY_SOURCE_MANUAL ENTROPY_MAX_SOURCES | #define ENTROPY_SOURCE_MANUAL ENTROPY_MAX_SOURCES | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* \brief Entropy poll callback pointer | * \brief Entropy poll callback pointer | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
error.h | error.h | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_ERROR_H | #ifndef POLARSSL_ERROR_H | |||
#define POLARSSL_ERROR_H | #define POLARSSL_ERROR_H | |||
#include <string.h> | ||||
/** | /** | |||
* Error code layout. | * Error code layout. | |||
* | * | |||
* Currently we try to keep all error codes within the negative space of 16 | * Currently we try to keep all error codes within the negative space of 16 | |||
* bytes signed integers to support all platforms (-0x0000 - -0x8000). In | * bytes signed integers to support all platforms (-0x0000 - -0x8000). In | |||
* addition we'd like to give two layers of information on the error if | * addition we'd like to give two layers of information on the error if | |||
* possible. | * possible. | |||
* | * | |||
* For that purpose the error codes are segmented in the following manner: | * For that purpose the error codes are segmented in the following manner: | |||
* | * | |||
skipping to change at line 70 | skipping to change at line 72 | |||
* CTR_DBRG 3 0x0034-0x003A | * CTR_DBRG 3 0x0034-0x003A | |||
* ENTROPY 3 0x003C-0x0040 | * ENTROPY 3 0x003C-0x0040 | |||
* NET 11 0x0042-0x0056 | * NET 11 0x0042-0x0056 | |||
* ASN1 7 0x0060-0x006C | * ASN1 7 0x0060-0x006C | |||
* MD2 1 0x0070-0x0070 | * MD2 1 0x0070-0x0070 | |||
* MD4 1 0x0072-0x0072 | * MD4 1 0x0072-0x0072 | |||
* MD5 1 0x0074-0x0074 | * MD5 1 0x0074-0x0074 | |||
* SHA1 1 0x0076-0x0076 | * SHA1 1 0x0076-0x0076 | |||
* SHA2 1 0x0078-0x0078 | * SHA2 1 0x0078-0x0078 | |||
* SHA4 1 0x007A-0x007A | * SHA4 1 0x007A-0x007A | |||
* PBKDF2 1 0x007C-0x007C | ||||
* | * | |||
* High-level module nr (3 bits - 0x1...-0x8...) | * High-level module nr (3 bits - 0x1...-0x8...) | |||
* Name ID Nr of Errors | * Name ID Nr of Errors | |||
* PEM 1 8 | * PEM 1 9 | |||
* X509 2 21 | * PKCS#12 1 4 (Started from top) | |||
* X509 2 23 | ||||
* DHM 3 6 | * DHM 3 6 | |||
* PKCS5 3 4 (Started from top) | ||||
* RSA 4 9 | * RSA 4 9 | |||
* MD 5 4 | * MD 5 4 | |||
* CIPHER 6 5 | * CIPHER 6 5 | |||
* SSL 6 2 (Started from top) | * SSL 6 2 (Started from top) | |||
* SSL 7 31 | * SSL 7 31 | |||
* | * | |||
* Module dependent error code (5 bits 0x.08.-0x.F8.) | * Module dependent error code (5 bits 0x.08.-0x.F8.) | |||
*/ | */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 6 lines changed or added | |||
md2.h | md2.h | |||
---|---|---|---|---|
/** | /** | |||
* \file md2.h | * \file md2.h | |||
* | * | |||
* \brief MD2 message digest algorithm (hash function) | * \brief MD2 message digest algorithm (hash function) | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_MD2_H | #ifndef POLARSSL_MD2_H | |||
#define POLARSSL_MD2_H | #define POLARSSL_MD2_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#define POLARSSL_ERR_MD2_FILE_IO_ERROR -0x0070 /**< Read/w rite error in file. */ | #define POLARSSL_ERR_MD2_FILE_IO_ERROR -0x0070 /**< Read/w rite error in file. */ | |||
#if !defined(POLARSSL_MD2_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief MD2 context structure | * \brief MD2 context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
unsigned char cksum[16]; /*!< checksum of the data block */ | unsigned char cksum[16]; /*!< checksum of the data block */ | |||
unsigned char state[48]; /*!< intermediate digest state */ | unsigned char state[48]; /*!< intermediate digest state */ | |||
unsigned char buffer[16]; /*!< data block being processed */ | unsigned char buffer[16]; /*!< data block being processed */ | |||
unsigned char ipad[16]; /*!< HMAC: inner padding */ | unsigned char ipad[16]; /*!< HMAC: inner padding */ | |||
skipping to change at line 77 | skipping to change at line 83 | |||
void md2_update( md2_context *ctx, const unsigned char *input, size_t ilen ); | void md2_update( md2_context *ctx, const unsigned char *input, size_t ilen ); | |||
/** | /** | |||
* \brief MD2 final digest | * \brief MD2 final digest | |||
* | * | |||
* \param ctx MD2 context | * \param ctx MD2 context | |||
* \param output MD2 checksum result | * \param output MD2 checksum result | |||
*/ | */ | |||
void md2_finish( md2_context *ctx, unsigned char output[16] ); | void md2_finish( md2_context *ctx, unsigned char output[16] ); | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_MD2_ALT */ | ||||
#include "md2_alt.h" | ||||
#endif /* POLARSSL_MD2_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Output = MD2( input buffer ) | * \brief Output = MD2( input buffer ) | |||
* | * | |||
* \param input buffer holding the data | * \param input buffer holding the data | |||
* \param ilen length of the input data | * \param ilen length of the input data | |||
* \param output MD2 checksum result | * \param output MD2 checksum result | |||
*/ | */ | |||
void md2( const unsigned char *input, size_t ilen, unsigned char output[16] ); | void md2( const unsigned char *input, size_t ilen, unsigned char output[16] ); | |||
/** | /** | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||
md4.h | md4.h | |||
---|---|---|---|---|
/** | /** | |||
* \file md4.h | * \file md4.h | |||
* | * | |||
* \brief MD4 message digest algorithm (hash function) | * \brief MD4 message digest algorithm (hash function) | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_MD4_H | #ifndef POLARSSL_MD4_H | |||
#define POLARSSL_MD4_H | #define POLARSSL_MD4_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define POLARSSL_ERR_MD4_FILE_IO_ERROR -0x0072 /**< Read/w rite error in file. */ | #define POLARSSL_ERR_MD4_FILE_IO_ERROR -0x0072 /**< Read/w rite error in file. */ | |||
#if !defined(POLARSSL_MD4_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief MD4 context structure | * \brief MD4 context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
uint32_t total[2]; /*!< number of bytes processed */ | uint32_t total[2]; /*!< number of bytes processed */ | |||
uint32_t state[4]; /*!< intermediate digest state */ | uint32_t state[4]; /*!< intermediate digest state */ | |||
unsigned char buffer[64]; /*!< data block being processed */ | unsigned char buffer[64]; /*!< data block being processed */ | |||
unsigned char ipad[64]; /*!< HMAC: inner padding */ | unsigned char ipad[64]; /*!< HMAC: inner padding */ | |||
skipping to change at line 83 | skipping to change at line 89 | |||
void md4_update( md4_context *ctx, const unsigned char *input, size_t ilen ); | void md4_update( md4_context *ctx, const unsigned char *input, size_t ilen ); | |||
/** | /** | |||
* \brief MD4 final digest | * \brief MD4 final digest | |||
* | * | |||
* \param ctx MD4 context | * \param ctx MD4 context | |||
* \param output MD4 checksum result | * \param output MD4 checksum result | |||
*/ | */ | |||
void md4_finish( md4_context *ctx, unsigned char output[16] ); | void md4_finish( md4_context *ctx, unsigned char output[16] ); | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_MD4_ALT */ | ||||
#include "md4_alt.h" | ||||
#endif /* POLARSSL_MD4_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Output = MD4( input buffer ) | * \brief Output = MD4( input buffer ) | |||
* | * | |||
* \param input buffer holding the data | * \param input buffer holding the data | |||
* \param ilen length of the input data | * \param ilen length of the input data | |||
* \param output MD4 checksum result | * \param output MD4 checksum result | |||
*/ | */ | |||
void md4( const unsigned char *input, size_t ilen, unsigned char output[16] ); | void md4( const unsigned char *input, size_t ilen, unsigned char output[16] ); | |||
/** | /** | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||
md5.h | md5.h | |||
---|---|---|---|---|
/** | /** | |||
* \file md5.h | * \file md5.h | |||
* | * | |||
* \brief MD5 message digest algorithm (hash function) | * \brief MD5 message digest algorithm (hash function) | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_MD5_H | #ifndef POLARSSL_MD5_H | |||
#define POLARSSL_MD5_H | #define POLARSSL_MD5_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define POLARSSL_ERR_MD5_FILE_IO_ERROR -0x0074 /**< Read/w rite error in file. */ | #define POLARSSL_ERR_MD5_FILE_IO_ERROR -0x0074 /**< Read/w rite error in file. */ | |||
#if !defined(POLARSSL_MD5_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief MD5 context structure | * \brief MD5 context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
uint32_t total[2]; /*!< number of bytes processed */ | uint32_t total[2]; /*!< number of bytes processed */ | |||
uint32_t state[4]; /*!< intermediate digest state */ | uint32_t state[4]; /*!< intermediate digest state */ | |||
unsigned char buffer[64]; /*!< data block being processed */ | unsigned char buffer[64]; /*!< data block being processed */ | |||
unsigned char ipad[64]; /*!< HMAC: inner padding */ | unsigned char ipad[64]; /*!< HMAC: inner padding */ | |||
skipping to change at line 83 | skipping to change at line 89 | |||
void md5_update( md5_context *ctx, const unsigned char *input, size_t ilen ); | void md5_update( md5_context *ctx, const unsigned char *input, size_t ilen ); | |||
/** | /** | |||
* \brief MD5 final digest | * \brief MD5 final digest | |||
* | * | |||
* \param ctx MD5 context | * \param ctx MD5 context | |||
* \param output MD5 checksum result | * \param output MD5 checksum result | |||
*/ | */ | |||
void md5_finish( md5_context *ctx, unsigned char output[16] ); | void md5_finish( md5_context *ctx, unsigned char output[16] ); | |||
/* Internal use */ | ||||
void md5_process( md5_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_MD5_ALT */ | ||||
#include "md5_alt.h" | ||||
#endif /* POLARSSL_MD5_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Output = MD5( input buffer ) | * \brief Output = MD5( input buffer ) | |||
* | * | |||
* \param input buffer holding the data | * \param input buffer holding the data | |||
* \param ilen length of the input data | * \param ilen length of the input data | |||
* \param output MD5 checksum result | * \param output MD5 checksum result | |||
*/ | */ | |||
void md5( const unsigned char *input, size_t ilen, unsigned char output[16] ); | void md5( const unsigned char *input, size_t ilen, unsigned char output[16] ); | |||
/** | /** | |||
skipping to change at line 157 | skipping to change at line 178 | |||
const unsigned char *input, size_t ilen, | const unsigned char *input, size_t ilen, | |||
unsigned char output[16] ); | unsigned char output[16] ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int md5_self_test( int verbose ); | int md5_self_test( int verbose ); | |||
/* Internal use */ | ||||
void md5_process( md5_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* md5.h */ | #endif /* md5.h */ | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 22 lines changed or added | |||
pbkdf2.h | pbkdf2.h | |||
---|---|---|---|---|
/** | /** | |||
* \file pbkdf2.h | * \file pbkdf2.h | |||
* | * | |||
* \brief Password-Based Key Derivation Function 2 (from PKCS#5) | * \brief Password-Based Key Derivation Function 2 (from PKCS#5) | |||
* DEPRECATED: use pkcs5.h instead. | ||||
* | * | |||
* \author Mathias Olsson <mathias@kompetensum.com> | * \author Mathias Olsson <mathias@kompetensum.com> | |||
* | * | |||
* Copyright (C) 2006-2012, Brainspark B.V. | * Copyright (C) 2006-2012, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
skipping to change at line 51 | skipping to change at line 52 | |||
#endif | #endif | |||
#define POLARSSL_ERR_PBKDF2_BAD_INPUT_DATA -0x007C /**< Ba d input parameters to function. */ | #define POLARSSL_ERR_PBKDF2_BAD_INPUT_DATA -0x007C /**< Ba d input parameters to function. */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* \brief PKCS#5 PBKDF2 using HMAC | * \brief PKCS#5 PBKDF2 using HMAC | |||
* DEPRECATED: Use pkcs5_pbkdf2_hmac() instead! | ||||
* | * | |||
* \param ctx Generic HMAC context | * \param ctx Generic HMAC context | |||
* \param password Password to use when generating key | * \param password Password to use when generating key | |||
* \param plen Length of password | * \param plen Length of password | |||
* \param salt Salt to use when generating key | * \param salt Salt to use when generating key | |||
* \param slen Length of salt | * \param slen Length of salt | |||
* \param iteration_count Iteration count | * \param iteration_count Iteration count | |||
* \param key_length Length of generated key | * \param key_length Length of generated key | |||
* \param output Generated key. Must be at least as big as key_length | * \param output Generated key. Must be at least as big as key_length | |||
* | * | |||
* \returns 0 on success, or a PolarSSL error code if verification f ails. | * \returns 0 on success, or a PolarSSL error code if verification f ails. | |||
*/ | */ | |||
int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password, | int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password, | |||
size_t plen, const unsigned char *salt, size_t slen, | size_t plen, const unsigned char *salt, size_t slen, | |||
unsigned int iteration_count, | unsigned int iteration_count, | |||
uint32_t key_length, unsigned char *output ); | uint32_t key_length, unsigned char *output ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* DEPRECATED: Use pkcs5_self_test() instead! | ||||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int pbkdf2_self_test( int verbose ); | int pbkdf2_self_test( int verbose ); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* pbkdf2.h */ | #endif /* pbkdf2.h */ | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
pem.h | pem.h | |||
---|---|---|---|---|
/** | /** | |||
* \file pem.h | * \file pem.h | |||
* | * | |||
* \brief Privacy Enhanced Mail (PEM) decoding | * \brief Privacy Enhanced Mail (PEM) decoding | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 38 | skipping to change at line 38 | |||
#define POLARSSL_PEM_H | #define POLARSSL_PEM_H | |||
#include <string.h> | #include <string.h> | |||
/** | /** | |||
* \name PEM Error codes | * \name PEM Error codes | |||
* These error codes are returned in case of errors reading the | * These error codes are returned in case of errors reading the | |||
* PEM data. | * PEM data. | |||
* \{ | * \{ | |||
*/ | */ | |||
#define POLARSSL_ERR_PEM_NO_HEADER_PRESENT -0x1080 /**< No PEM header found. */ | #define POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT -0x1080 /**< No PEM header or footer found. */ | |||
#define POLARSSL_ERR_PEM_INVALID_DATA -0x1100 /**< PE M string is not as expected. */ | #define POLARSSL_ERR_PEM_INVALID_DATA -0x1100 /**< PE M string is not as expected. */ | |||
#define POLARSSL_ERR_PEM_MALLOC_FAILED -0x1180 /**< Fa iled to allocate memory. */ | #define POLARSSL_ERR_PEM_MALLOC_FAILED -0x1180 /**< Fa iled to allocate memory. */ | |||
#define POLARSSL_ERR_PEM_INVALID_ENC_IV -0x1200 /**< RS A IV is not in hex-format. */ | #define POLARSSL_ERR_PEM_INVALID_ENC_IV -0x1200 /**< RS A IV is not in hex-format. */ | |||
#define POLARSSL_ERR_PEM_UNKNOWN_ENC_ALG -0x1280 /**< Un supported key encryption algorithm. */ | #define POLARSSL_ERR_PEM_UNKNOWN_ENC_ALG -0x1280 /**< Un supported key encryption algorithm. */ | |||
#define POLARSSL_ERR_PEM_PASSWORD_REQUIRED -0x1300 /**< Pr ivate key password can't be empty. */ | #define POLARSSL_ERR_PEM_PASSWORD_REQUIRED -0x1300 /**< Pr ivate key password can't be empty. */ | |||
#define POLARSSL_ERR_PEM_PASSWORD_MISMATCH -0x1380 /**< Gi ven private key password does not allow for correct decryption. */ | #define POLARSSL_ERR_PEM_PASSWORD_MISMATCH -0x1380 /**< Gi ven private key password does not allow for correct decryption. */ | |||
#define POLARSSL_ERR_PEM_FEATURE_UNAVAILABLE -0x1400 /**< Un available feature, e.g. hashing/encryption combination. */ | #define POLARSSL_ERR_PEM_FEATURE_UNAVAILABLE -0x1400 /**< Un available feature, e.g. hashing/encryption combination. */ | |||
#define POLARSSL_ERR_PEM_BAD_INPUT_DATA -0x1480 /**< Ba d input parameters to function. */ | ||||
/* \} name */ | /* \} name */ | |||
/** | /** | |||
* \brief PEM context structure | * \brief PEM context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
unsigned char *buf; /*!< buffer for decoded data */ | unsigned char *buf; /*!< buffer for decoded data */ | |||
size_t buflen; /*!< length of the buffer */ | size_t buflen; /*!< length of the buffer */ | |||
unsigned char *info; /*!< buffer for extra header information */ | unsigned char *info; /*!< buffer for extra header information */ | |||
skipping to change at line 80 | skipping to change at line 81 | |||
/** | /** | |||
* \brief Read a buffer for PEM information and store the resulting | * \brief Read a buffer for PEM information and store the resulting | |||
* data into the specified context buffers. | * data into the specified context buffers. | |||
* | * | |||
* \param ctx context to use | * \param ctx context to use | |||
* \param header header string to seek and expect | * \param header header string to seek and expect | |||
* \param footer footer string to seek and expect | * \param footer footer string to seek and expect | |||
* \param data source data to look in | * \param data source data to look in | |||
* \param pwd password for decryption (can be NULL) | * \param pwd password for decryption (can be NULL) | |||
* \param pwdlen length of password | * \param pwdlen length of password | |||
* \param use_len destination for total length used | * \param use_len destination for total length used (set after header is | |||
* correctly read, so unless you get | ||||
* POLARSSL_ERR_PEM_BAD_INPUT_DATA or | ||||
* POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT, use_len is | ||||
* the length to skip) | ||||
* | * | |||
* \return 0 on success, ior a specific PEM error code | * \return 0 on success, ior a specific PEM error code | |||
*/ | */ | |||
int pem_read_buffer( pem_context *ctx, char *header, char *footer, | int pem_read_buffer( pem_context *ctx, char *header, char *footer, | |||
const unsigned char *data, | const unsigned char *data, | |||
const unsigned char *pwd, | const unsigned char *pwd, | |||
size_t pwdlen, size_t *use_len ); | size_t pwdlen, size_t *use_len ); | |||
/** | /** | |||
* \brief PEM context memory freeing | * \brief PEM context memory freeing | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 8 lines changed or added | |||
sha1.h | sha1.h | |||
---|---|---|---|---|
/** | /** | |||
* \file sha1.h | * \file sha1.h | |||
* | * | |||
* \brief SHA-1 cryptographic hash function | * \brief SHA-1 cryptographic hash function | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_SHA1_H | #ifndef POLARSSL_SHA1_H | |||
#define POLARSSL_SHA1_H | #define POLARSSL_SHA1_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076 /**< Read/w rite error in file. */ | #define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076 /**< Read/w rite error in file. */ | |||
#if !defined(POLARSSL_SHA1_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief SHA-1 context structure | * \brief SHA-1 context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
uint32_t total[2]; /*!< number of bytes processed */ | uint32_t total[2]; /*!< number of bytes processed */ | |||
uint32_t state[5]; /*!< intermediate digest state */ | uint32_t state[5]; /*!< intermediate digest state */ | |||
unsigned char buffer[64]; /*!< data block being processed */ | unsigned char buffer[64]; /*!< data block being processed */ | |||
unsigned char ipad[64]; /*!< HMAC: inner padding */ | unsigned char ipad[64]; /*!< HMAC: inner padding */ | |||
skipping to change at line 83 | skipping to change at line 89 | |||
void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ile n ); | void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ile n ); | |||
/** | /** | |||
* \brief SHA-1 final digest | * \brief SHA-1 final digest | |||
* | * | |||
* \param ctx SHA-1 context | * \param ctx SHA-1 context | |||
* \param output SHA-1 checksum result | * \param output SHA-1 checksum result | |||
*/ | */ | |||
void sha1_finish( sha1_context *ctx, unsigned char output[20] ); | void sha1_finish( sha1_context *ctx, unsigned char output[20] ); | |||
/* Internal use */ | ||||
void sha1_process( sha1_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_SHA1_ALT */ | ||||
#include "sha1_alt.h" | ||||
#endif /* POLARSSL_SHA1_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Output = SHA-1( input buffer ) | * \brief Output = SHA-1( input buffer ) | |||
* | * | |||
* \param input buffer holding the data | * \param input buffer holding the data | |||
* \param ilen length of the input data | * \param ilen length of the input data | |||
* \param output SHA-1 checksum result | * \param output SHA-1 checksum result | |||
*/ | */ | |||
void sha1( const unsigned char *input, size_t ilen, unsigned char output[20 ] ); | void sha1( const unsigned char *input, size_t ilen, unsigned char output[20 ] ); | |||
/** | /** | |||
skipping to change at line 155 | skipping to change at line 176 | |||
const unsigned char *input, size_t ilen, | const unsigned char *input, size_t ilen, | |||
unsigned char output[20] ); | unsigned char output[20] ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int sha1_self_test( int verbose ); | int sha1_self_test( int verbose ); | |||
/* Internal use */ | ||||
void sha1_process( sha1_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* sha1.h */ | #endif /* sha1.h */ | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 22 lines changed or added | |||
sha2.h | sha2.h | |||
---|---|---|---|---|
/** | /** | |||
* \file sha2.h | * \file sha2.h | |||
* | * | |||
* \brief SHA-224 and SHA-256 cryptographic hash function | * \brief SHA-224 and SHA-256 cryptographic hash function | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_SHA2_H | #ifndef POLARSSL_SHA2_H | |||
#define POLARSSL_SHA2_H | #define POLARSSL_SHA2_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define POLARSSL_ERR_SHA2_FILE_IO_ERROR -0x0078 /**< Read/w rite error in file. */ | #define POLARSSL_ERR_SHA2_FILE_IO_ERROR -0x0078 /**< Read/w rite error in file. */ | |||
#if !defined(POLARSSL_SHA2_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief SHA-256 context structure | * \brief SHA-256 context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
uint32_t total[2]; /*!< number of bytes processed */ | uint32_t total[2]; /*!< number of bytes processed */ | |||
uint32_t state[8]; /*!< intermediate digest state */ | uint32_t state[8]; /*!< intermediate digest state */ | |||
unsigned char buffer[64]; /*!< data block being processed */ | unsigned char buffer[64]; /*!< data block being processed */ | |||
unsigned char ipad[64]; /*!< HMAC: inner padding */ | unsigned char ipad[64]; /*!< HMAC: inner padding */ | |||
skipping to change at line 85 | skipping to change at line 91 | |||
void sha2_update( sha2_context *ctx, const unsigned char *input, size_t ile n ); | void sha2_update( sha2_context *ctx, const unsigned char *input, size_t ile n ); | |||
/** | /** | |||
* \brief SHA-256 final digest | * \brief SHA-256 final digest | |||
* | * | |||
* \param ctx SHA-256 context | * \param ctx SHA-256 context | |||
* \param output SHA-224/256 checksum result | * \param output SHA-224/256 checksum result | |||
*/ | */ | |||
void sha2_finish( sha2_context *ctx, unsigned char output[32] ); | void sha2_finish( sha2_context *ctx, unsigned char output[32] ); | |||
/* Internal use */ | ||||
void sha2_process( sha2_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_SHA2_ALT */ | ||||
#include "sha2_alt.h" | ||||
#endif /* POLARSSL_SHA2_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Output = SHA-256( input buffer ) | * \brief Output = SHA-256( input buffer ) | |||
* | * | |||
* \param input buffer holding the data | * \param input buffer holding the data | |||
* \param ilen length of the input data | * \param ilen length of the input data | |||
* \param output SHA-224/256 checksum result | * \param output SHA-224/256 checksum result | |||
* \param is224 0 = use SHA256, 1 = use SHA224 | * \param is224 0 = use SHA256, 1 = use SHA224 | |||
*/ | */ | |||
void sha2( const unsigned char *input, size_t ilen, | void sha2( const unsigned char *input, size_t ilen, | |||
unsigned char output[32], int is224 ); | unsigned char output[32], int is224 ); | |||
skipping to change at line 163 | skipping to change at line 184 | |||
const unsigned char *input, size_t ilen, | const unsigned char *input, size_t ilen, | |||
unsigned char output[32], int is224 ); | unsigned char output[32], int is224 ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int sha2_self_test( int verbose ); | int sha2_self_test( int verbose ); | |||
/* Internal use */ | ||||
void sha2_process( sha2_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* sha2.h */ | #endif /* sha2.h */ | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 22 lines changed or added | |||
sha4.h | sha4.h | |||
---|---|---|---|---|
/** | /** | |||
* \file sha4.h | * \file sha4.h | |||
* | * | |||
* \brief SHA-384 and SHA-512 cryptographic hash function | * \brief SHA-384 and SHA-512 cryptographic hash function | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_SHA4_H | #ifndef POLARSSL_SHA4_H | |||
#define POLARSSL_SHA4_H | #define POLARSSL_SHA4_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#if defined(_MSC_VER) || defined(__WATCOMC__) | #if defined(_MSC_VER) || defined(__WATCOMC__) | |||
#define UL64(x) x##ui64 | #define UL64(x) x##ui64 | |||
typedef unsigned __int64 uint64_t; | typedef unsigned __int64 uint64_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#define UL64(x) x##ULL | #define UL64(x) x##ULL | |||
#endif | #endif | |||
#define POLARSSL_ERR_SHA4_FILE_IO_ERROR -0x007A /**< Read/w rite error in file. */ | #define POLARSSL_ERR_SHA4_FILE_IO_ERROR -0x007A /**< Read/w rite error in file. */ | |||
#if !defined(POLARSSL_SHA1_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief SHA-512 context structure | * \brief SHA-512 context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
uint64_t total[2]; /*!< number of bytes processed */ | uint64_t total[2]; /*!< number of bytes processed */ | |||
uint64_t state[8]; /*!< intermediate digest state */ | uint64_t state[8]; /*!< intermediate digest state */ | |||
unsigned char buffer[128]; /*!< data block being processed */ | unsigned char buffer[128]; /*!< data block being processed */ | |||
unsigned char ipad[128]; /*!< HMAC: inner padding */ | unsigned char ipad[128]; /*!< HMAC: inner padding */ | |||
skipping to change at line 86 | skipping to change at line 92 | |||
void sha4_update( sha4_context *ctx, const unsigned char *input, size_t ile n ); | void sha4_update( sha4_context *ctx, const unsigned char *input, size_t ile n ); | |||
/** | /** | |||
* \brief SHA-512 final digest | * \brief SHA-512 final digest | |||
* | * | |||
* \param ctx SHA-512 context | * \param ctx SHA-512 context | |||
* \param output SHA-384/512 checksum result | * \param output SHA-384/512 checksum result | |||
*/ | */ | |||
void sha4_finish( sha4_context *ctx, unsigned char output[64] ); | void sha4_finish( sha4_context *ctx, unsigned char output[64] ); | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_SHA4_ALT */ | ||||
#include "sha4_alt.h" | ||||
#endif /* POLARSSL_SHA4_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Output = SHA-512( input buffer ) | * \brief Output = SHA-512( input buffer ) | |||
* | * | |||
* \param input buffer holding the data | * \param input buffer holding the data | |||
* \param ilen length of the input data | * \param ilen length of the input data | |||
* \param output SHA-384/512 checksum result | * \param output SHA-384/512 checksum result | |||
* \param is384 0 = use SHA512, 1 = use SHA384 | * \param is384 0 = use SHA512, 1 = use SHA384 | |||
*/ | */ | |||
void sha4( const unsigned char *input, size_t ilen, | void sha4( const unsigned char *input, size_t ilen, | |||
unsigned char output[64], int is384 ); | unsigned char output[64], int is384 ); | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||
ssl.h | ssl.h | |||
---|---|---|---|---|
/** | /** | |||
* \file ssl.h | * \file ssl.h | |||
* | * | |||
* \brief SSL/TLS functions. | * \brief SSL/TLS functions. | |||
* | * | |||
* Copyright (C) 2006-2012, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 126 | skipping to change at line 126 | |||
#define SSL_LEGACY_RENEGOTIATION 0 | #define SSL_LEGACY_RENEGOTIATION 0 | |||
#define SSL_SECURE_RENEGOTIATION 1 | #define SSL_SECURE_RENEGOTIATION 1 | |||
#define SSL_RENEGOTIATION_DISABLED 0 | #define SSL_RENEGOTIATION_DISABLED 0 | |||
#define SSL_RENEGOTIATION_ENABLED 1 | #define SSL_RENEGOTIATION_ENABLED 1 | |||
#define SSL_LEGACY_NO_RENEGOTIATION 0 | #define SSL_LEGACY_NO_RENEGOTIATION 0 | |||
#define SSL_LEGACY_ALLOW_RENEGOTIATION 1 | #define SSL_LEGACY_ALLOW_RENEGOTIATION 1 | |||
#define SSL_LEGACY_BREAK_HANDSHAKE 2 | #define SSL_LEGACY_BREAK_HANDSHAKE 2 | |||
#define SSL_MAX_CONTENT_LEN 16384 | /* | |||
* Size of the input / output buffer. | ||||
* Note: the RFC defines the default size of SSL / TLS messages. If you | ||||
* change the value here, other clients / servers may not be able to | ||||
* communicate with you anymore. Only change this value if you control | ||||
* both sides of the connection and have it reduced at both sides! | ||||
*/ | ||||
#if !defined(POLARSSL_CONFIG_OPTIONS) | ||||
#define SSL_MAX_CONTENT_LEN 16384 /**< Size of the input / output | ||||
buffer */ | ||||
#endif /* !POLARSSL_CONFIG_OPTIONS */ | ||||
/* | /* | |||
* Allow an extra 512 bytes for the record header | * Allow an extra 512 bytes for the record header | |||
* and encryption overhead (counter + MAC + padding) | * and encryption overhead (counter + MAC + padding) | |||
* and allow for a maximum of 1024 of compression expansion if | * and allow for a maximum of 1024 of compression expansion if | |||
* enabled. | * enabled. | |||
*/ | */ | |||
#if defined(POLARSSL_ZLIB_SUPPORT) | #if defined(POLARSSL_ZLIB_SUPPORT) | |||
#define SSL_COMPRESSION_ADD 1024 | #define SSL_COMPRESSION_ADD 1024 | |||
#else | #else | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 12 lines changed or added | |||
ssl_cache.h | ssl_cache.h | |||
---|---|---|---|---|
/** | /** | |||
* \file ssl_cache.h | * \file ssl_cache.h | |||
* | * | |||
* \brief SSL session cache implementation | * \brief SSL session cache implementation | |||
* | * | |||
* Copyright (C) 2006-2012, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 32 | skipping to change at line 32 | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_SSL_CACHE_H | #ifndef POLARSSL_SSL_CACHE_H | |||
#define POLARSSL_SSL_CACHE_H | #define POLARSSL_SSL_CACHE_H | |||
#include "ssl.h" | #include "ssl.h" | |||
#if !defined(POLARSSL_CONFIG_OPTIONS) | ||||
#define SSL_CACHE_DEFAULT_TIMEOUT 86400 /*!< 1 day */ | #define SSL_CACHE_DEFAULT_TIMEOUT 86400 /*!< 1 day */ | |||
#define SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /*!< Maximum entries in cac he */ | #define SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /*!< Maximum entries in cac he */ | |||
#endif /* !POLARSSL_CONFIG_OPTIONS */ | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
typedef struct _ssl_cache_context ssl_cache_context; | typedef struct _ssl_cache_context ssl_cache_context; | |||
typedef struct _ssl_cache_entry ssl_cache_entry; | typedef struct _ssl_cache_entry ssl_cache_entry; | |||
/** | /** | |||
* \brief This structure is used for storing cache entries | * \brief This structure is used for storing cache entries | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added | |||
version.h | version.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#define POLARSSL_VERSION_H | #define POLARSSL_VERSION_H | |||
#include "config.h" | #include "config.h" | |||
/** | /** | |||
* The version number x.y.z is split into three parts. | * The version number x.y.z is split into three parts. | |||
* Major, Minor, Patchlevel | * Major, Minor, Patchlevel | |||
*/ | */ | |||
#define POLARSSL_VERSION_MAJOR 1 | #define POLARSSL_VERSION_MAJOR 1 | |||
#define POLARSSL_VERSION_MINOR 2 | #define POLARSSL_VERSION_MINOR 2 | |||
#define POLARSSL_VERSION_PATCH 7 | #define POLARSSL_VERSION_PATCH 8 | |||
/** | /** | |||
* The single version number has the following structure: | * The single version number has the following structure: | |||
* MMNNPP00 | * MMNNPP00 | |||
* Major version | Minor version | Patch version | * Major version | Minor version | Patch version | |||
*/ | */ | |||
#define POLARSSL_VERSION_NUMBER 0x01020700 | #define POLARSSL_VERSION_NUMBER 0x01020800 | |||
#define POLARSSL_VERSION_STRING "1.2.7" | #define POLARSSL_VERSION_STRING "1.2.8" | |||
#define POLARSSL_VERSION_STRING_FULL "PolarSSL 1.2.7" | #define POLARSSL_VERSION_STRING_FULL "PolarSSL 1.2.8" | |||
#if defined(POLARSSL_VERSION_C) | #if defined(POLARSSL_VERSION_C) | |||
/** | /** | |||
* Get the version number. | * Get the version number. | |||
* | * | |||
* \return The constructed version number in the format | * \return The constructed version number in the format | |||
* MMNNPP00 (Major, Minor, Patch). | * MMNNPP00 (Major, Minor, Patch). | |||
*/ | */ | |||
unsigned int version_get_number( void ); | unsigned int version_get_number( void ); | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
x509.h | x509.h | |||
---|---|---|---|---|
skipping to change at line 65 | skipping to change at line 65 | |||
#define POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG -0x2680 /**< Si gnature algorithm (oid) is unsupported. */ | #define POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG -0x2680 /**< Si gnature algorithm (oid) is unsupported. */ | |||
#define POLARSSL_ERR_X509_UNKNOWN_PK_ALG -0x2700 /**< Ke y algorithm is unsupported (only RSA is supported). */ | #define POLARSSL_ERR_X509_UNKNOWN_PK_ALG -0x2700 /**< Ke y algorithm is unsupported (only RSA is supported). */ | |||
#define POLARSSL_ERR_X509_CERT_SIG_MISMATCH -0x2780 /**< Ce rtificate signature algorithms do not match. (see \c ::x509_cert sig_oid) * / | #define POLARSSL_ERR_X509_CERT_SIG_MISMATCH -0x2780 /**< Ce rtificate signature algorithms do not match. (see \c ::x509_cert sig_oid) * / | |||
#define POLARSSL_ERR_X509_CERT_VERIFY_FAILED -0x2800 /**< Ce rtificate verification failed, e.g. CRL, CA or signature check failed. */ | #define POLARSSL_ERR_X509_CERT_VERIFY_FAILED -0x2800 /**< Ce rtificate verification failed, e.g. CRL, CA or signature check failed. */ | |||
#define POLARSSL_ERR_X509_KEY_INVALID_VERSION -0x2880 /**< Un supported RSA key version */ | #define POLARSSL_ERR_X509_KEY_INVALID_VERSION -0x2880 /**< Un supported RSA key version */ | |||
#define POLARSSL_ERR_X509_KEY_INVALID_FORMAT -0x2900 /**< In valid RSA key tag or value. */ | #define POLARSSL_ERR_X509_KEY_INVALID_FORMAT -0x2900 /**< In valid RSA key tag or value. */ | |||
#define POLARSSL_ERR_X509_CERT_UNKNOWN_FORMAT -0x2980 /**< Fo rmat not recognized as DER or PEM. */ | #define POLARSSL_ERR_X509_CERT_UNKNOWN_FORMAT -0x2980 /**< Fo rmat not recognized as DER or PEM. */ | |||
#define POLARSSL_ERR_X509_INVALID_INPUT -0x2A00 /**< In put invalid. */ | #define POLARSSL_ERR_X509_INVALID_INPUT -0x2A00 /**< In put invalid. */ | |||
#define POLARSSL_ERR_X509_MALLOC_FAILED -0x2A80 /**< Al location of memory failed. */ | #define POLARSSL_ERR_X509_MALLOC_FAILED -0x2A80 /**< Al location of memory failed. */ | |||
#define POLARSSL_ERR_X509_FILE_IO_ERROR -0x2B00 /**< Re ad/write of file failed. */ | #define POLARSSL_ERR_X509_FILE_IO_ERROR -0x2B00 /**< Re ad/write of file failed. */ | |||
#define POLARSSL_ERR_X509_PASSWORD_REQUIRED -0x2B80 /**< Pr | ||||
ivate key password can't be empty. */ | ||||
#define POLARSSL_ERR_X509_PASSWORD_MISMATCH -0x2C00 /**< Gi | ||||
ven private key password does not allow for correct decryption. */ | ||||
/* \} name */ | /* \} name */ | |||
/** | /** | |||
* \name X509 Verify codes | * \name X509 Verify codes | |||
* \{ | * \{ | |||
*/ | */ | |||
#define BADCERT_EXPIRED 0x01 /**< The certificate validity has expired. */ | #define BADCERT_EXPIRED 0x01 /**< The certificate validity has expired. */ | |||
#define BADCERT_REVOKED 0x02 /**< The certificate has been rev oked (is on a CRL). */ | #define BADCERT_REVOKED 0x02 /**< The certificate has been rev oked (is on a CRL). */ | |||
#define BADCERT_CN_MISMATCH 0x04 /**< The certificate Common Name (CN) does not match with the expected CN. */ | #define BADCERT_CN_MISMATCH 0x04 /**< The certificate Common Name (CN) does not match with the expected CN. */ | |||
#define BADCERT_NOT_TRUSTED 0x08 /**< The certificate is not corre ctly signed by the trusted CA. */ | #define BADCERT_NOT_TRUSTED 0x08 /**< The certificate is not corre ctly signed by the trusted CA. */ | |||
skipping to change at line 427 | skipping to change at line 429 | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* \name Functions to read in DHM parameters, a certificate, CRL or private RSA key | * \name Functions to read in DHM parameters, a certificate, CRL or private RSA key | |||
* \{ | * \{ | |||
*/ | */ | |||
/** \ingroup x509_module */ | /** \ingroup x509_module */ | |||
/** | /** | |||
* \brief Parse a single DER formatted certificate and add it | ||||
* to the chained list. | ||||
* | ||||
* \param chain points to the start of the chain | ||||
* \param buf buffer holding the certificate DER data | ||||
* \param buflen size of the buffer | ||||
* | ||||
* \return 0 if successful, or a specific X509 or PEM error code | ||||
*/ | ||||
int x509parse_crt_der( x509_cert *chain, const unsigned char *buf, size_t b | ||||
uflen ); | ||||
/** | ||||
* \brief Parse one or more certificates and add them | * \brief Parse one or more certificates and add them | |||
* to the chained list. Parses permissively. If some | * to the chained list. Parses permissively. If some | |||
* certificates can be parsed, the result is the number | * certificates can be parsed, the result is the number | |||
* of failed certificates it encountered. If none complete | * of failed certificates it encountered. If none complete | |||
* correctly, the first error is returned. | * correctly, the first error is returned. | |||
* | * | |||
* \param chain points to the start of the chain | * \param chain points to the start of the chain | |||
* \param buf buffer holding the certificate data | * \param buf buffer holding the certificate data | |||
* \param buflen size of the buffer | * \param buflen size of the buffer | |||
* | * | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 17 lines changed or added | |||
xtea.h | xtea.h | |||
---|---|---|---|---|
/** | /** | |||
* \file xtea.h | * \file xtea.h | |||
* | * | |||
* \brief XTEA block cipher (32-bit) | * \brief XTEA block cipher (32-bit) | |||
* | * | |||
* Copyright (C) 2006-2010, Brainspark B.V. | * Copyright (C) 2006-2013, Brainspark B.V. | |||
* | * | |||
* This file is part of PolarSSL (http://www.polarssl.org) | * This file is part of PolarSSL (http://www.polarssl.org) | |||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> | |||
* | * | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
skipping to change at line 30 | skipping to change at line 30 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License along | * 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., | * with this program; if not, write to the Free Software Foundation, Inc., | |||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |||
*/ | */ | |||
#ifndef POLARSSL_XTEA_H | #ifndef POLARSSL_XTEA_H | |||
#define POLARSSL_XTEA_H | #define POLARSSL_XTEA_H | |||
#include "config.h" | ||||
#include <string.h> | #include <string.h> | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define XTEA_ENCRYPT 1 | #define XTEA_ENCRYPT 1 | |||
#define XTEA_DECRYPT 0 | #define XTEA_DECRYPT 0 | |||
#define POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028 /**< Th e data input has an invalid length. */ | #define POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH -0x0028 /**< Th e data input has an invalid length. */ | |||
#if !defined(POLARSSL_XTEA_ALT) | ||||
// Regular implementation | ||||
// | ||||
/** | /** | |||
* \brief XTEA context structure | * \brief XTEA context structure | |||
*/ | */ | |||
typedef struct | typedef struct | |||
{ | { | |||
uint32_t k[4]; /*!< key */ | uint32_t k[4]; /*!< key */ | |||
} | } | |||
xtea_context; | xtea_context; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
skipping to change at line 100 | skipping to change at line 106 | |||
* \return 0 if successful, | * \return 0 if successful, | |||
* POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH if the length % 8 != 0 | * POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH if the length % 8 != 0 | |||
*/ | */ | |||
int xtea_crypt_cbc( xtea_context *ctx, | int xtea_crypt_cbc( xtea_context *ctx, | |||
int mode, | int mode, | |||
size_t length, | size_t length, | |||
unsigned char iv[8], | unsigned char iv[8], | |||
unsigned char *input, | unsigned char *input, | |||
unsigned char *output); | unsigned char *output); | |||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#else /* POLARSSL_XTEA_ALT */ | ||||
#include "xtea_alt.h" | ||||
#endif /* POLARSSL_XTEA_ALT */ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int xtea_self_test( int verbose ); | int xtea_self_test( int verbose ); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||