cyassl re-port with cellular comms, PSK test

Dependencies:   VodafoneUSBModem_bleedingedge2 mbed-rtos mbed-src

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers des.h Source File

des.h

00001 /* des.h
00002  *
00003  * Copyright (C) 2012 Sawtooth Consulting Ltd.
00004  *
00005  * This file is part of CyaSSL.
00006  *
00007  * CyaSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * CyaSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00020  */
00021 
00022 
00023 /*  des.h defines mini des openssl compatibility layer 
00024  *
00025  */
00026 
00027 
00028 #ifndef CYASSL_DES_H_
00029 #define CYASSL_DES_H_
00030 
00031 #include <cyassl/ctaocrypt/settings.h>
00032 
00033 #ifdef YASSL_PREFIX
00034 #include "prefix_des.h"
00035 #endif
00036 
00037 
00038 #ifdef __cplusplus
00039     extern "C" {
00040 #endif
00041 
00042 typedef unsigned char CYASSL_DES_cblock[8];
00043 typedef /* const */ CYASSL_DES_cblock CYASSL_const_DES_cblock;
00044 typedef CYASSL_DES_cblock CYASSL_DES_key_schedule;
00045 
00046 
00047 enum {
00048     DES_ENCRYPT = 1,
00049     DES_DECRYPT = 0
00050 };
00051 
00052 
00053 CYASSL_API void CyaSSL_DES_set_key_unchecked(CYASSL_const_DES_cblock*,
00054                                              CYASSL_DES_key_schedule*);
00055 CYASSL_API int  CyaSSL_DES_key_sched(CYASSL_const_DES_cblock* key,
00056                                      CYASSL_DES_key_schedule* schedule);
00057 CYASSL_API void CyaSSL_DES_cbc_encrypt(const unsigned char* input,
00058                      unsigned char* output, long length,
00059                      CYASSL_DES_key_schedule* schedule, CYASSL_DES_cblock* ivec,
00060                      int enc);
00061 CYASSL_API void CyaSSL_DES_ncbc_encrypt(const unsigned char* input,
00062                       unsigned char* output, long length,
00063                       CYASSL_DES_key_schedule* schedule,
00064                       CYASSL_DES_cblock* ivec, int enc);
00065 
00066 CYASSL_API void CyaSSL_DES_set_odd_parity(CYASSL_DES_cblock*);
00067 CYASSL_API void CyaSSL_DES_ecb_encrypt(CYASSL_DES_cblock*, CYASSL_DES_cblock*,
00068                                        CYASSL_DES_key_schedule*, int);
00069 
00070 
00071 typedef CYASSL_DES_cblock DES_cblock;
00072 typedef CYASSL_const_DES_cblock const_DES_cblock;
00073 typedef CYASSL_DES_key_schedule DES_key_schedule;
00074 
00075 #define DES_set_key_unchecked CyaSSL_DES_set_key_unchecked
00076 #define DES_key_sched CyaSSL_DES_key_sched
00077 #define DES_cbc_encrypt CyaSSL_DES_cbc_encrypt
00078 #define DES_ncbc_encrypt CyaSSL_DES_ncbc_encrypt
00079 #define DES_set_odd_parity CyaSSL_DES_set_odd_parity
00080 #define DES_ecb_encrypt CyaSSL_DES_ecb_encrypt
00081 
00082 #ifdef __cplusplus
00083     } /* extern "C" */
00084 #endif
00085 
00086 
00087 #endif /* CYASSL_DES_H_ */