OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / netflash / crypto.h
1 #ifndef __NETFLASH_CRYPTO_H__
2 #define __NETFLASH_CRYPTO_H__
3
4 #include <openssl/rsa.h>
5 #include <openssl/pem.h>
6 #include <openssl/md5.h>
7 #include <openssl/aes.h>
8
9 #define CRYPTO_MAGIC            0xb9b1e546
10 #define LITTLE_CRYPTO_MAGIC     0x2ad6
11
12 #define AESKEYSIZE              (256/8)
13
14 #define FLAG_ENCRYPTED          0x01
15
16 /*
17  * Have to pack this structure. It has been known to change size from
18  * host to target system which causes a few problems!
19  */
20 struct header {
21         unsigned int magic;
22 #ifdef CONFIG_USER_NETFLASH_CRYPTO_V2
23         unsigned char hash[SHA256_DIGEST_LENGTH];
24 #else
25         unsigned char md5[MD5_DIGEST_LENGTH];
26 #endif
27         unsigned char aeskey[AESKEYSIZE];
28         unsigned char flags;
29         unsigned char padsize;
30 } __attribute__ ((packed));
31
32 struct little_header {
33         unsigned short hlen;    /* Length of encrypted header block */
34         unsigned short magic;   /* Magic number for identification purposes */
35 };
36
37 #endif