瀏覽代碼

[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
  *
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
  * Set key
36
  * Set key
48
  *
37
  *
154
 }
143
 }
155
 
144
 
156
 /** Basic AES algorithm */
145
 /** Basic AES algorithm */
157
-static struct cipher_algorithm aes_algorithm = {
146
+struct cipher_algorithm aes_algorithm = {
158
 	.name = "aes",
147
 	.name = "aes",
159
 	.ctxsize = sizeof ( struct aes_context ),
148
 	.ctxsize = sizeof ( struct aes_context ),
160
 	.blocksize = AES_BLOCKSIZE,
149
 	.blocksize = AES_BLOCKSIZE,

+ 17
- 0
src/include/gpxe/aes.h 查看文件

5
 
5
 
6
 struct cipher_algorithm;
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
 extern struct cipher_algorithm aes_cbc_algorithm;
25
 extern struct cipher_algorithm aes_cbc_algorithm;
9
 
26
 
10
 #endif /* _GPXE_AES_H */
27
 #endif /* _GPXE_AES_H */

Loading…
取消
儲存