|
1 /* |
|
2 --------------------------------------------------------------------------- |
|
3 Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. |
|
4 |
|
5 LICENSE TERMS |
|
6 |
|
7 The free distribution and use of this software in both source and binary |
|
8 form is allowed (with or without changes) provided that: |
|
9 |
|
10 1. distributions of this source code include the above copyright |
|
11 notice, this list of conditions and the following disclaimer; |
|
12 |
|
13 2. distributions in binary form include the above copyright |
|
14 notice, this list of conditions and the following disclaimer |
|
15 in the documentation and/or other associated materials; |
|
16 |
|
17 3. the copyright holder's name is not used to endorse products |
|
18 built using this software without specific written permission. |
|
19 |
|
20 ALTERNATIVELY, provided that this notice is retained in full, this product |
|
21 may be distributed under the terms of the GNU General Public License (GPL), |
|
22 in which case the provisions of the GPL apply INSTEAD OF those given above. |
|
23 |
|
24 DISCLAIMER |
|
25 |
|
26 This software is provided 'as is' with no explicit or implied warranties |
|
27 in respect of its properties, including, but not limited to, correctness |
|
28 and/or fitness for purpose. |
|
29 --------------------------------------------------------------------------- |
|
30 Issue 16/04/2007 |
|
31 */ |
|
32 |
|
33 /* This file changed 5 June 2007, extracted from "aeskey.c", extracting |
|
34 only those portions needed to use gcm-mode in an OpenSSL environment. |
|
35 Changed by Peter Lovell, SPARTA Inc., for DTN project. |
|
36 */ |
|
37 |
|
38 #ifdef HAVE_CONFIG_H |
|
39 # include <dtn-config.h> |
|
40 #endif |
|
41 |
|
42 #ifdef BSP_ENABLED |
|
43 |
|
44 #include "gcm_aes.h" |
|
45 |
|
46 #if defined(__cplusplus) |
|
47 extern "C" |
|
48 { |
|
49 #endif |
|
50 |
|
51 |
|
52 AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx* cx) |
|
53 { |
|
54 if ( key_len < 128 ) |
|
55 key_len *= 8; /* convert byte-count to bit-count */ |
|
56 |
|
57 AES_set_encrypt_key(key, key_len, cx); |
|
58 return; |
|
59 } |
|
60 |
|
61 |
|
62 #if defined(__cplusplus) |
|
63 } |
|
64 #endif |
|
65 |
|
66 #endif /* BSP_ENABLED */ |