diff options
Diffstat (limited to 'umac.c')
-rw-r--r-- | umac.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: umac.c,v 1.9 2014/04/20 02:30:25 djm Exp $ */ | 1 | /* $OpenBSD: umac.c,v 1.10 2014/04/30 19:07:48 naddy Exp $ */ |
2 | /* ----------------------------------------------------------------------- | 2 | /* ----------------------------------------------------------------------- |
3 | * | 3 | * |
4 | * umac.c -- C Implementation UMAC Message Authentication | 4 | * umac.c -- C Implementation UMAC Message Authentication |
@@ -154,6 +154,7 @@ typedef unsigned int UWORD; /* Register */ | |||
154 | #define AES_BLOCK_LEN 16 | 154 | #define AES_BLOCK_LEN 16 |
155 | 155 | ||
156 | /* OpenSSL's AES */ | 156 | /* OpenSSL's AES */ |
157 | #ifdef WITH_OPENSSL | ||
157 | #include "openbsd-compat/openssl-compat.h" | 158 | #include "openbsd-compat/openssl-compat.h" |
158 | #ifndef USE_BUILTIN_RIJNDAEL | 159 | #ifndef USE_BUILTIN_RIJNDAEL |
159 | # include <openssl/aes.h> | 160 | # include <openssl/aes.h> |
@@ -163,6 +164,16 @@ typedef AES_KEY aes_int_key[1]; | |||
163 | AES_encrypt((u_char *)(in),(u_char *)(out),(AES_KEY *)int_key) | 164 | AES_encrypt((u_char *)(in),(u_char *)(out),(AES_KEY *)int_key) |
164 | #define aes_key_setup(key,int_key) \ | 165 | #define aes_key_setup(key,int_key) \ |
165 | AES_set_encrypt_key((const u_char *)(key),UMAC_KEY_LEN*8,int_key) | 166 | AES_set_encrypt_key((const u_char *)(key),UMAC_KEY_LEN*8,int_key) |
167 | #else | ||
168 | #include "rijndael.h" | ||
169 | #define AES_ROUNDS ((UMAC_KEY_LEN / 4) + 6) | ||
170 | typedef UINT8 aes_int_key[AES_ROUNDS+1][4][4]; /* AES internal */ | ||
171 | #define aes_encryption(in,out,int_key) \ | ||
172 | rijndaelEncrypt((u32 *)(int_key), AES_ROUNDS, (u8 *)(in), (u8 *)(out)) | ||
173 | #define aes_key_setup(key,int_key) \ | ||
174 | rijndaelKeySetupEnc((u32 *)(int_key), (const unsigned char *)(key), \ | ||
175 | UMAC_KEY_LEN*8) | ||
176 | #endif | ||
166 | 177 | ||
167 | /* The user-supplied UMAC key is stretched using AES in a counter | 178 | /* The user-supplied UMAC key is stretched using AES in a counter |
168 | * mode to supply all random bits needed by UMAC. The kdf function takes | 179 | * mode to supply all random bits needed by UMAC. The kdf function takes |