diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-03-23 02:45:35 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-03-23 02:45:35 +0100 |
commit | aa6673fcfbe3bc41078487f4ef5d5aea459cd953 (patch) | |
tree | 691a08eb0191904f7f8ba8a7f9ad4939aafa9907 /sys/include | |
parent | 7ff779ff52b3da9c3b4cfee38cd90088ac65d6c3 (diff) |
add portable AES-GCM (Galois/Counter Mode) implementation to libsec and devtls
Diffstat (limited to 'sys/include')
-rw-r--r-- | sys/include/libsec.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/include/libsec.h b/sys/include/libsec.h index bd76b1377..6cd04cdfa 100644 --- a/sys/include/libsec.h +++ b/sys/include/libsec.h @@ -27,7 +27,7 @@ struct AESstate ulong ekey[4*(AESmaxrounds + 1)]; /* encryption key */ ulong dkey[4*(AESmaxrounds + 1)]; /* decryption key */ uchar ivec[AESbsize]; /* initialization vector */ - uchar mackey[3 * AESbsize]; /* 3 XCBC mac 96 keys */ + uchar mackey[3 * AESbsize]; /* 3 XCBC mac 96 keys */ }; /* block ciphers */ @@ -41,6 +41,20 @@ void aesCBCdecrypt(uchar *p, int len, AESstate *s); void setupAESXCBCstate(AESstate *s); uchar* aesXCBCmac(uchar *p, int len, AESstate *s); +typedef struct AESGCMstate AESGCMstate; +struct AESGCMstate +{ + AESstate; + + ulong H[4]; + ulong M[16][256][4]; +}; + +void setupAESGCMstate(AESGCMstate *s, uchar *key, int keylen, uchar *iv, int ivlen); +void aesgcm_setiv(AESGCMstate *s, uchar *iv, int ivlen); +void aesgcm_encrypt(uchar *dat, ulong ndat, uchar *aad, ulong naad, uchar tag[16], AESGCMstate *s); +int aesgcm_decrypt(uchar *dat, ulong ndat, uchar *aad, ulong naad, uchar tag[16], AESGCMstate *s); + /* * Blowfish Definitions */ |