Преглед изворни кода

[crypto] Make AES context size and algorithm structure externally available

This is required to support modes of AES beyond cipher-block chaining.

Signed-off-by: Marty Connor <mdc@etherboot.org>
tags/v1.0.0-rc1
Joshua Oreman пре 15 година
родитељ
комит
2dfe4c414a
2 измењених фајлова са 18 додато и 12 уклоњено
  1. 1
    12
      src/crypto/axtls_aes.c
  2. 17
    0
      src/include/gpxe/aes.h

+ 1
- 12
src/crypto/axtls_aes.c Прегледај датотеку

@@ -32,17 +32,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
32 32
  *
33 33
  */
34 34
 
35
-/** Basic AES blocksize */
36
-#define AES_BLOCKSIZE 16
37
-
38
-/** AES context */
39
-struct aes_context {
40
-	/** AES context for AXTLS */
41
-	AES_CTX axtls_ctx;
42
-	/** Cipher is being used for decrypting */
43
-	int decrypting;
44
-};
45
-
46 35
 /**
47 36
  * Set key
48 37
  *
@@ -154,7 +143,7 @@ static void aes_decrypt ( void *ctx, const void *src, void *dst,
154 143
 }
155 144
 
156 145
 /** Basic AES algorithm */
157
-static struct cipher_algorithm aes_algorithm = {
146
+struct cipher_algorithm aes_algorithm = {
158 147
 	.name = "aes",
159 148
 	.ctxsize = sizeof ( struct aes_context ),
160 149
 	.blocksize = AES_BLOCKSIZE,

+ 17
- 0
src/include/gpxe/aes.h Прегледај датотеку

@@ -5,6 +5,23 @@ FILE_LICENCE ( GPL2_OR_LATER );
5 5
 
6 6
 struct cipher_algorithm;
7 7
 
8
+/** Basic AES blocksize */
9
+#define AES_BLOCKSIZE 16
10
+
11
+#include "crypto/axtls/crypto.h"
12
+
13
+/** AES context */
14
+struct aes_context {
15
+	/** AES context for AXTLS */
16
+	AES_CTX axtls_ctx;
17
+	/** Cipher is being used for decrypting */
18
+	int decrypting;
19
+};
20
+
21
+/** AES context size */
22
+#define AES_CTX_SIZE sizeof ( struct aes_context )
23
+
24
+extern struct cipher_algorithm aes_algorithm;
8 25
 extern struct cipher_algorithm aes_cbc_algorithm;
9 26
 
10 27
 #endif /* _GPXE_AES_H */

Loading…
Откажи
Сачувај