OpenZWave Library  1.4.5216
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros | Functions
aeskey.c File Reference
#include "aesopt.h"
#include "aestab.h"
+ Include dependency graph for aeskey.c:

Macros

#define aes_xi(x)   aes_ ## x
 
#define ke4(k, i)
 
#define kef6(k, i)
 
#define ke6(k, i)
 
#define kef8(k, i)
 
#define ke8(k, i)
 
#define v(n, i)   ((n) - (i) + 2 * ((i) & 3))
 
#define ff(x)   inv_mcol(x)
 
#define k4e(k, i)
 
#define kdf4(k, i)
 
#define kd4(k, i)
 
#define kdl4(k, i)
 
#define k6ef(k, i)
 
#define k6e(k, i)
 
#define kdf6(k, i)
 
#define kd6(k, i)
 
#define kdl6(k, i)
 
#define k8ef(k, i)
 
#define k8e(k, i)
 
#define kdf8(k, i)
 
#define kd8(k, i)
 
#define kdl8(k, i)
 

Functions

AES_RETURN aes_xi() encrypt_key128 (const unsigned char *key, aes_encrypt_ctx cx[1])
 
AES_RETURN aes_xi() encrypt_key192 (const unsigned char *key, aes_encrypt_ctx cx[1])
 
AES_RETURN aes_xi() encrypt_key256 (const unsigned char *key, aes_encrypt_ctx cx[1])
 
AES_RETURN aes_xi() decrypt_key128 (const unsigned char *key, aes_decrypt_ctx cx[1])
 
AES_RETURN aes_xi() decrypt_key192 (const unsigned char *key, aes_decrypt_ctx cx[1])
 
AES_RETURN aes_xi() decrypt_key256 (const unsigned char *key, aes_decrypt_ctx cx[1])
 
AES_RETURN aes_encrypt_key (const unsigned char *key, int key_len, aes_encrypt_ctx cx[1])
 
AES_RETURN aes_decrypt_key (const unsigned char *key, int key_len, aes_decrypt_ctx cx[1])
 

Macro Definition Documentation

#define aes_xi (   x)    aes_ ## x
#define ff (   x)    inv_mcol(x)
#define k4e (   k,
 
)
Value:
{ k[v(40,(4*(i))+4)] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \
k[v(40,(4*(i))+5)] = ss[1] ^= ss[0]; \
k[v(40,(4*(i))+6)] = ss[2] ^= ss[1]; \
k[v(40,(4*(i))+7)] = ss[3] ^= ss[2]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define k6e (   k,
 
)
Value:
{ k6ef(k,i); \
k[v(48,(6*(i))+10)] = ss[4] ^= ss[3]; \
k[v(48,(6*(i))+11)] = ss[5] ^= ss[4]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define k6ef(k, i)
Definition: aeskey.c:345
#define k6ef (   k,
 
)
Value:
{ k[v(48,(6*(i))+ 6)] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \
k[v(48,(6*(i))+ 7)] = ss[1] ^= ss[0]; \
k[v(48,(6*(i))+ 8)] = ss[2] ^= ss[1]; \
k[v(48,(6*(i))+ 9)] = ss[3] ^= ss[2]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define k8e (   k,
 
)
Value:
{ k8ef(k,i); \
k[v(56,(8*(i))+12)] = ss[4] ^= ls_box(ss[3],0); \
k[v(56,(8*(i))+13)] = ss[5] ^= ss[4]; \
k[v(56,(8*(i))+14)] = ss[6] ^= ss[5]; \
k[v(56,(8*(i))+15)] = ss[7] ^= ss[6]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ls_box(x, c)
Definition: aesopt.h:752
#define k8ef(k, i)
Definition: aeskey.c:430
#define k8ef (   k,
 
)
Value:
{ k[v(56,(8*(i))+ 8)] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \
k[v(56,(8*(i))+ 9)] = ss[1] ^= ss[0]; \
k[v(56,(8*(i))+10)] = ss[2] ^= ss[1]; \
k[v(56,(8*(i))+11)] = ss[3] ^= ss[2]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kd4 (   k,
 
)
Value:
{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \
ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \
k[v(40,(4*(i))+4)] = ss[4] ^= k[v(40,(4*(i)))]; \
k[v(40,(4*(i))+5)] = ss[4] ^= k[v(40,(4*(i))+1)]; \
k[v(40,(4*(i))+6)] = ss[4] ^= k[v(40,(4*(i))+2)]; \
k[v(40,(4*(i))+7)] = ss[4] ^= k[v(40,(4*(i))+3)]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ff(x)
Definition: aeskey.c:232
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kd6 (   k,
 
)
Value:
{ ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \
ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[v(48,(6*(i))+ 6)] = ss[6] ^= k[v(48,(6*(i)))]; \
ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[6] ^= k[v(48,(6*(i))+ 1)]; \
ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[6] ^= k[v(48,(6*(i))+ 2)]; \
ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[6] ^= k[v(48,(6*(i))+ 3)]; \
ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ss[6] ^= k[v(48,(6*(i))+ 4)]; \
ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ss[6] ^= k[v(48,(6*(i))+ 5)]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ff(x)
Definition: aeskey.c:232
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kd8 (   k,
 
)
Value:
{ ss[8] = ls_box(ss[7],3) ^ t_use(r,c)[i]; \
ss[0] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+ 8)] = ss[8] ^= k[v(56,(8*(i)))]; \
ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[8] ^= k[v(56,(8*(i))+ 1)]; \
ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[8] ^= k[v(56,(8*(i))+ 2)]; \
ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[8] ^= k[v(56,(8*(i))+ 3)]; \
ss[8] = ls_box(ss[3],0); \
ss[4] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+12)] = ss[8] ^= k[v(56,(8*(i))+ 4)]; \
ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ss[8] ^= k[v(56,(8*(i))+ 5)]; \
ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ss[8] ^= k[v(56,(8*(i))+ 6)]; \
ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ss[8] ^= k[v(56,(8*(i))+ 7)]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ff(x)
Definition: aeskey.c:232
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kdf4 (   k,
 
)
Value:
{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; \
ss[1] = ss[1] ^ ss[3]; \
ss[2] = ss[2] ^ ss[3]; \
ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \
ss[i % 4] ^= ss[4]; \
ss[4] ^= k[v(40,(4*(i)))]; k[v(40,(4*(i))+4)] = ff(ss[4]); \
ss[4] ^= k[v(40,(4*(i))+1)]; k[v(40,(4*(i))+5)] = ff(ss[4]); \
ss[4] ^= k[v(40,(4*(i))+2)]; k[v(40,(4*(i))+6)] = ff(ss[4]); \
ss[4] ^= k[v(40,(4*(i))+3)]; k[v(40,(4*(i))+7)] = ff(ss[4]); \
}
#define v(n, i)
Definition: aeskey.c:224
#define ff(x)
Definition: aeskey.c:232
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kdf6 (   k,
 
)
Value:
{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ff(ss[0]); \
ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ff(ss[1]); \
ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ff(ss[2]); \
ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ff(ss[3]); \
ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ff(ss[4]); \
ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ff(ss[5]); \
}
#define v(n, i)
Definition: aeskey.c:224
#define ff(x)
Definition: aeskey.c:232
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kdf8 (   k,
 
)
Value:
{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ff(ss[0]); \
ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ff(ss[1]); \
ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ff(ss[2]); \
ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ff(ss[3]); \
ss[4] ^= ls_box(ss[3],0); k[v(56,(8*(i))+12)] = ff(ss[4]); \
ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ff(ss[5]); \
ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ff(ss[6]); \
ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ff(ss[7]); \
}
#define v(n, i)
Definition: aeskey.c:224
#define ff(x)
Definition: aeskey.c:232
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kdl4 (   k,
 
)
Value:
{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \
k[v(40,(4*(i))+4)] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; \
k[v(40,(4*(i))+5)] = ss[1] ^ ss[3]; \
k[v(40,(4*(i))+6)] = ss[0]; \
k[v(40,(4*(i))+7)] = ss[1]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kdl6 (   k,
 
)
Value:
{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ss[0]; \
ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[1]; \
ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[2]; \
ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[3]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kdl8 (   k,
 
)
Value:
{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ss[0]; \
ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[1]; \
ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[2]; \
ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[3]; \
}
#define v(n, i)
Definition: aeskey.c:224
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define ke4 (   k,
 
)
Value:
{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \
k[4*(i)+5] = ss[1] ^= ss[0]; \
k[4*(i)+6] = ss[2] ^= ss[1]; \
k[4*(i)+7] = ss[3] ^= ss[2]; \
}
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define ke6 (   k,
 
)
Value:
{ kef6(k,i); \
k[6*(i)+10] = ss[4] ^= ss[3]; \
k[6*(i)+11] = ss[5] ^= ss[4]; \
}
#define kef6(k, i)
Definition: aeskey.c:117
#define ke8 (   k,
 
)
Value:
{ kef8(k,i); \
k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); \
k[8*(i)+13] = ss[5] ^= ss[4]; \
k[8*(i)+14] = ss[6] ^= ss[5]; \
k[8*(i)+15] = ss[7] ^= ss[6]; \
}
#define ls_box(x, c)
Definition: aesopt.h:752
#define kef8(k, i)
Definition: aeskey.c:166
#define kef6 (   k,
 
)
Value:
{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \
k[6*(i)+ 7] = ss[1] ^= ss[0]; \
k[6*(i)+ 8] = ss[2] ^= ss[1]; \
k[6*(i)+ 9] = ss[3] ^= ss[2]; \
}
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define kef8 (   k,
 
)
Value:
{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \
k[8*(i)+ 9] = ss[1] ^= ss[0]; \
k[8*(i)+10] = ss[2] ^= ss[1]; \
k[8*(i)+11] = ss[3] ^= ss[2]; \
}
#define ls_box(x, c)
Definition: aesopt.h:752
#define t_use(m, n)
Definition: aestab.h:70
#define v (   n,
 
)    ((n) - (i) + 2 * ((i) & 3))

Function Documentation

AES_RETURN aes_decrypt_key ( const unsigned char *  key,
int  key_len,
aes_decrypt_ctx  cx[1] 
)
AES_RETURN aes_encrypt_key ( const unsigned char *  key,
int  key_len,
aes_encrypt_ctx  cx[1] 
)
AES_RETURN aes_xi() decrypt_key128 ( const unsigned char *  key,
aes_decrypt_ctx  cx[1] 
)
AES_RETURN aes_xi() decrypt_key192 ( const unsigned char *  key,
aes_decrypt_ctx  cx[1] 
)
AES_RETURN aes_xi() decrypt_key256 ( const unsigned char *  key,
aes_decrypt_ctx  cx[1] 
)
AES_RETURN aes_xi() encrypt_key128 ( const unsigned char *  key,
aes_encrypt_ctx  cx[1] 
)
AES_RETURN aes_xi() encrypt_key192 ( const unsigned char *  key,
aes_encrypt_ctx  cx[1] 
)
AES_RETURN aes_xi() encrypt_key256 ( const unsigned char *  key,
aes_encrypt_ctx  cx[1] 
)