]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
Make context sizes available for statically-allocated structures
authorMichael Brown <mcb30@etherboot.org>
Thu, 1 Feb 2007 05:48:56 +0000 (05:48 +0000)
committerMichael Brown <mcb30@etherboot.org>
Thu, 1 Feb 2007 05:48:56 +0000 (05:48 +0000)
src/crypto/axtls_sha1.c
src/crypto/md5.c
src/include/gpxe/md5.h
src/include/gpxe/sha1.h

index 17c087977ba9f1a3d6b75ae063b40ae431e2ac2c..b44fe7fe830ba771be3e76a3071f031253f1defd 100644 (file)
@@ -17,7 +17,7 @@ static void sha1_final ( void *ctx, void *out ) {
 
 struct crypto_algorithm sha1_algorithm = {
        .name           = "sha1",
-       .ctxsize        = sizeof ( SHA1_CTX ),
+       .ctxsize        = SHA1_CTX_SIZE,
        .blocksize      = 64,
        .digestsize     = SHA1_SIZE,
        .init           = sha1_init,
index 94ab69a292e2d36977a0ca852a86e78d38966d0e..09378e20fa021cdc5698059fc8022d1e6abdd512 100644 (file)
 #include <gpxe/crypto.h>
 #include <gpxe/md5.h>
 
-#define MD5_DIGEST_SIZE                16
-#define MD5_BLOCK_WORDS                16
-#define MD5_HASH_WORDS         4
-
-struct md5_ctx {
-       u32 hash[MD5_HASH_WORDS];
-       u32 block[MD5_BLOCK_WORDS];
-       u64 byte_count;
-};
-
 #define __md5step __attribute__ (( regparm ( 3 ) ))
 
 struct md5_step {
@@ -236,7 +226,7 @@ static void md5_final(void *context, void *out)
 
 struct crypto_algorithm md5_algorithm = {
        .name           = "md5",
-       .ctxsize        = sizeof ( struct md5_ctx ),
+       .ctxsize        = MD5_CTX_SIZE,
        .blocksize      = ( MD5_BLOCK_WORDS * 4 ),
        .digestsize     = MD5_DIGEST_SIZE,
        .init           = md5_init,
index f82c946254e3c02054f95e35f1ca9a34fefd3ef7..304a0e646cbf02c612d4753967a1c75419ce5816 100644 (file)
@@ -3,6 +3,20 @@
 
 struct crypto_algorithm;
 
+#include <stdint.h>
+
+#define MD5_DIGEST_SIZE                16
+#define MD5_BLOCK_WORDS                16
+#define MD5_HASH_WORDS         4
+
+struct md5_ctx {
+       u32 hash[MD5_HASH_WORDS];
+       u32 block[MD5_BLOCK_WORDS];
+       u64 byte_count;
+};
+
+#define MD5_CTX_SIZE sizeof ( struct md5_ctx )
+
 extern struct crypto_algorithm md5_algorithm;
 
 #endif /* _GPXE_MD5_H */
index 1425d54cf8ff0b54e44dbb1db242f73f7fb1d647..0a811018c20d577a26bd106b5665b3f73c9fdbbf 100644 (file)
@@ -1,8 +1,12 @@
 #ifndef _GPXE_SHA1_H
 #define _GPXE_SHA1_H
 
+#include "crypto/axtls/crypto.h"
+
 struct crypto_algorithm;
 
+#define SHA1_CTX_SIZE sizeof ( SHA1_CTX )
+
 extern struct crypto_algorithm sha1_algorithm;
 
 #endif /* _GPXE_SHA1_H */