IBR-DTNSuite  0.8
ibrcommon/ibrcommon/ssl/gcm/gcm_aes.c
Go to the documentation of this file.
00001 /*
00002  ---------------------------------------------------------------------------
00003  Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved.
00004 
00005  LICENSE TERMS
00006 
00007  The free distribution and use of this software in both source and binary
00008  form is allowed (with or without changes) provided that:
00009 
00010    1. distributions of this source code include the above copyright
00011       notice, this list of conditions and the following disclaimer;
00012 
00013    2. distributions in binary form include the above copyright
00014       notice, this list of conditions and the following disclaimer
00015       in the documentation and/or other associated materials;
00016 
00017    3. the copyright holder's name is not used to endorse products
00018       built using this software without specific written permission.
00019 
00020  ALTERNATIVELY, provided that this notice is retained in full, this product
00021  may be distributed under the terms of the GNU General Public License (GPL),
00022  in which case the provisions of the GPL apply INSTEAD OF those given above.
00023 
00024  DISCLAIMER
00025 
00026  This software is provided 'as is' with no explicit or implied warranties
00027  in respect of its properties, including, but not limited to, correctness
00028  and/or fitness for purpose.
00029  ---------------------------------------------------------------------------
00030  Issue 16/04/2007
00031 */
00032 
00033 /*  This file changed 5 June 2007, extracted from "aeskey.c", extracting
00034     only those portions needed to use gcm-mode in an OpenSSL environment.
00035     Changed by Peter Lovell, SPARTA Inc., for DTN project.
00036 */
00037 
00038 //#ifdef HAVE_CONFIG_H
00039 //#  include <dtn-config.h>
00040 //#endif
00041 #define BSP_ENABLED true
00042 
00043 #ifdef BSP_ENABLED
00044 
00045 #include "gcm_aes.h"
00046 
00047 #if defined(__cplusplus)
00048 extern "C"
00049 {
00050 #endif
00051 
00052 
00053 AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx* cx)
00054 {
00055     if ( key_len < 128 )
00056         key_len *= 8;       /* convert byte-count to bit-count */
00057     
00058     AES_set_encrypt_key(key, key_len, cx); 
00059     return;
00060 }
00061 
00062 
00063 #if defined(__cplusplus)
00064 }
00065 #endif
00066 
00067 #endif /* BSP_ENABLED */