#include <string.h>#include <limits.h>Go to the source code of this file.
Macros | |
| #define | AES___ 128 |
| #define | BLOCKCIPHERS 1 |
| #define | AEAD_MODES 1 |
| #define | ECB 1 |
| #define | CBC 1 |
| #define | CFB 1 |
| #define | OFB 1 |
| #define | CTR 1 |
| #define | XEX 1 |
| #define | KWA 1 |
| #define | FPE 1 |
| #define | CMAC 1 |
| #define | CCM 1 |
| #define | GCM 1 |
| #define | EAX 1 |
| #define | SIV 1 |
| #define | GCM_SIV 1 |
| #define | OCB 1 |
| #define | POLY1305 1 |
| #define | CTS 1 |
| #define | XTS 1 |
| #define | CTR_NA 1 |
| #define | EAXP 0 |
| #define | WTF ! (BLOCKCIPHERS | AEAD_MODES) |
| #define | MICRO_RJNDL WTF |
| #define | AES_PADDING 0 |
| #define | DECRYPTION 1 |
| #define | CUSTOM_ALPHABET 0 |
| #define | FF_X 1 |
| #define | PRESET_COUNTER 0 |
| #define | SDCC_REENT |
Enumerations | |
| enum | constant_parameters_of_modes { CTR_START_VALUE = 1 , CTR_IV_LENGTH = 12 , CCM_NONCE_LEN = 11 , CCM_TAG_LEN = 16 , GCM_NONCE_LEN = 12 , GCM_TAG_LEN = 16 , SIVGCM_NONCE_LEN = 12 , SIVGCM_TAG_LEN = 16 , OCB_NONCE_LEN = 12 , OCB_TAG_LEN = 16 , EAX_NONCE_LEN = 16 , EAX_TAG_LEN = 16 , AES_KEYLENGTH = 16 } |
| enum | function_result_codes { M_ENCRYPTION_ERROR = 'E' , M_DECRYPTION_ERROR = 'D' , M_AUTHENTICATION_ERROR = 'A' , M_DATALENGTH_ERROR = 'L' , M_DATAFORMAT_ERROR = 'F' , M_MEMORY_ERROR = 'M' , M_SUCCESS = 0 } |
Functions | |
| void | SPP_EXTERNAL_ENCRYPTION_ecbEncrypt (const uint8_t *key, const void *pntxt, const size_t ptextLen, void *crtxt) |
| encrypt the input plaintext using ECB-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_ecbDecrypt (const uint8_t *key, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| decrypt the input ciphertext using ECB-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_cbcEncrypt (const uint8_t *key, const uint8_t iVec[16], const void *pntxt, const size_t ptextLen, void *crtxt) |
| char | SPP_EXTERNAL_ENCRYPTION_cbcDecrypt (const uint8_t *key, const uint8_t iVec[16], const void *crtxt, const size_t crtxtLen, void *pntxt) |
| void | SPP_EXTERNAL_ENCRYPTION_cfbEncrypt (const uint8_t *key, const uint8_t iVec[16], const void *pntxt, const size_t ptextLen, void *crtxt) |
| void | SPP_EXTERNAL_ENCRYPTION_cfbDecrypt (const uint8_t *key, const uint8_t iVec[16], const void *crtxt, const size_t crtxtLen, void *pntxt) |
| void | SPP_EXTERNAL_ENCRYPTION_ofbEncrypt (const uint8_t *key, const uint8_t iVec[16], const void *pntxt, const size_t ptextLen, void *crtxt) |
| void | SPP_EXTERNAL_ENCRYPTION_ofbDecrypt (const uint8_t *key, const uint8_t iVec[16], const void *crtxt, const size_t crtxtLen, void *pntxt) |
| char | SPP_EXTERNAL_ENCRYPTION_xtsEncrypt (const uint8_t *keys, const uint8_t *tweak, const void *pntxt, const size_t ptextLen, void *crtxt) |
| encrypt the input plaintext using XTS-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_xtsDecrypt (const uint8_t *keys, const uint8_t *tweak, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| encrypt the input ciphertext using XTS-AES block-cipher method | |
| void | SPP_EXTERNAL_ENCRYPTION_ctrEncrypt (const uint8_t *key, const uint8_t *iv, const void *pntxt, const size_t ptextLen, void *crtxt) |
| encrypt the input plaintext using CTR-AES block-cipher method | |
| void | SPP_EXTERNAL_ENCRYPTION_ctrDecrypt (const uint8_t *key, const uint8_t *iv, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| decrypt the input ciphertext using CTR-AES block-cipher method | |
| void | SPP_EXTERNAL_ENCRYPTION_sivEncrypt (const uint8_t *keys, const void *aData, const size_t aDataLen, const void *pntxt, const size_t ptextLen, uint8_t iv[16], void *crtxt) |
| char | SPP_EXTERNAL_ENCRYPTION_sivDecrypt (const uint8_t *keys, const uint8_t iv[16], const void *aData, const size_t aDataLen, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| void | SPP_EXTERNAL_ENCRYPTION_gcmEncrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *pntxt, const size_t ptextLen, void *crtxt) |
| encrypt the input plaintext using GCM-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_gcmDecrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| decrypt the input ciphertext using GCM-AES block-cipher method | |
| void | SPP_EXTERNAL_ENCRYPTION_ccmEncrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *pntxt, const size_t ptextLen, void *crtxt) |
| encrypt the input plaintext using CCM-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_ccmDecrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| decrypt the input ciphertext using CCM-AES block-cipher method | |
| void | SPP_EXTERNAL_ENCRYPTION_ocbEncrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *pntxt, const size_t ptextLen, void *crtxt) |
| encrypt the input stream using OCB-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_ocbDecrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| decrypt the input stream using OCB-AES block-cipher method | |
| void | SPP_EXTERNAL_ENCRYPTION_eaxEncrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *pntxt, const size_t ptextLen, void *crtxt) |
| encrypt the input plaintext using EAX-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_eaxDecrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| decrypt the input ciphertext using EAX-AES block-cipher method | |
| void | SPP_EXTERNAL_ENCRYPTION_gcmSivEncrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *pntxt, const size_t ptextLen, void *crtxt) |
| encrypt the input plaintext using SIV-GCM-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_gcmSivDecrypt (const uint8_t *key, const uint8_t *nonce, const void *aData, const size_t aDataLen, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| decrypt the input ciphertext using SIV-GCM-AES block-cipher method | |
| char | SPP_EXTERNAL_ENCRYPTION_keyWrap (const uint8_t *kek, const void *secret, const size_t secretLen, void *wrapped) |
| encrypt the input secret with key-wrapping method | |
| char | SPP_EXTERNAL_ENCRYPTION_keyUnwrap (const uint8_t *kek, const void *wrapped, const size_t wrapLen, void *secret) |
| unwrap/decrypt a wrapped secret according to RFC-3394 | |
| char | SPP_EXTERNAL_ENCRYPTION_fpeEncrypt (const uint8_t *key, const uint8_t *tweak, const size_t tweakLen, const void *pntxt, const size_t ptextLen, void *crtxt) |
| char | SPP_EXTERNAL_ENCRYPTION_fpeDecrypt (const uint8_t *key, const uint8_t *tweak, const size_t tweakLen, const void *crtxt, const size_t crtxtLen, void *pntxt) |
| void | SPP_EXTERNAL_ENCRYPTION_poly1305 (const uint8_t *keys, const uint8_t nonce[16], const void *data, const size_t dataSize, uint8_t mac[16]) |
| void | SPP_EXTERNAL_ENCRYPTION_cmac (const uint8_t *key, const void *data, const size_t dataSize, uint8_t mac[16]) |
| #define AES___ 128 |
Definition at line 18 of file encryption.h.
| #define BLOCKCIPHERS 1 |
AES block-cipher modes of operation. The following modes can be enabled/disabled
Definition at line 24 of file encryption.h.
| #define AEAD_MODES 1 |
Definition at line 25 of file encryption.h.
| #define ECB 1 |
Definition at line 28 of file encryption.h.
| #define CBC 1 |
Definition at line 29 of file encryption.h.
| #define CFB 1 |
Definition at line 30 of file encryption.h.
| #define OFB 1 |
Definition at line 31 of file encryption.h.
| #define CTR 1 |
Definition at line 32 of file encryption.h.
| #define XEX 1 |
Definition at line 33 of file encryption.h.
| #define KWA 1 |
Definition at line 34 of file encryption.h.
| #define FPE 1 |
Definition at line 35 of file encryption.h.
| #define CMAC 1 |
Definition at line 39 of file encryption.h.
| #define CCM 1 |
Definition at line 42 of file encryption.h.
| #define GCM 1 |
Definition at line 43 of file encryption.h.
| #define EAX 1 |
Definition at line 44 of file encryption.h.
| #define SIV 1 |
Definition at line 45 of file encryption.h.
| #define GCM_SIV 1 |
Definition at line 46 of file encryption.h.
| #define OCB 1 |
Definition at line 50 of file encryption.h.
| #define POLY1305 1 |
Definition at line 53 of file encryption.h.
| #define CTS 1 |
Definition at line 57 of file encryption.h.
| #define XTS 1 |
Definition at line 61 of file encryption.h.
| #define CTR_NA 1 |
Definition at line 65 of file encryption.h.
| #define EAXP 0 |
Definition at line 69 of file encryption.h.
Referenced by SPP_EXTERNAL_ENCRYPTION_eaxDecrypt(), SPP_EXTERNAL_ENCRYPTION_eaxEncrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| #define WTF ! (BLOCKCIPHERS | AEAD_MODES) |
Definition at line 72 of file encryption.h.
| #define MICRO_RJNDL WTF |
Definition at line 73 of file encryption.h.
| #define AES_PADDING 0 |
Definition at line 80 of file encryption.h.
Referenced by padBlock().
| #define DECRYPTION 1 |
Definition at line 84 of file encryption.h.
| #define CUSTOM_ALPHABET 0 |
Definition at line 88 of file encryption.h.
| #define FF_X 1 |
Definition at line 89 of file encryption.h.
Referenced by SPP_EXTERNAL_ENCRYPTION_fpeDecrypt(), and SPP_EXTERNAL_ENCRYPTION_fpeEncrypt().
| #define PRESET_COUNTER 0 |
Definition at line 101 of file encryption.h.
| #define SDCC_REENT |
Definition at line 153 of file encryption.h.
| Enumerator | |
|---|---|
| CTR_START_VALUE | |
| CTR_IV_LENGTH | |
| CCM_NONCE_LEN | |
| CCM_TAG_LEN | |
| GCM_NONCE_LEN | |
| GCM_TAG_LEN | |
| SIVGCM_NONCE_LEN | |
| SIVGCM_TAG_LEN | |
| OCB_NONCE_LEN | |
| OCB_TAG_LEN | |
| EAX_NONCE_LEN | |
| EAX_TAG_LEN | |
| AES_KEYLENGTH | |
Definition at line 92 of file encryption.h.
| Enumerator | |
|---|---|
| M_ENCRYPTION_ERROR | |
| M_DECRYPTION_ERROR | |
| M_AUTHENTICATION_ERROR | |
| M_DATALENGTH_ERROR | |
| M_DATAFORMAT_ERROR | |
| M_MEMORY_ERROR | |
| M_SUCCESS | |
Definition at line 470 of file encryption.h.
| void SPP_EXTERNAL_ENCRYPTION_ecbEncrypt | ( | const uint8_t * | key, |
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
encrypt the input plaintext using ECB-AES block-cipher method
| key | encryption key with a fixed size specified by KEYSIZE |
| pntxt | input plaintext buffer |
| ptextLen | size of plaintext in bytes |
| crtxt | resulting cipher-text buffer |
Definition at line 639 of file encryption.c.
References AES_setkey, BLOCKSIZE, BURN, padBlock(), rijndaelEncrypt(), RoundKey, and SPP_EXTERNAL_ENCRYPTION_ecbEncrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_ecbEncrypt().
| char SPP_EXTERNAL_ENCRYPTION_ecbDecrypt | ( | const uint8_t * | key, |
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
decrypt the input ciphertext using ECB-AES block-cipher method
| key | decryption key with a fixed size specified by KEYSIZE |
| crtxt | input ciphertext buffer |
| crtxtLen | size of ciphertext in bytes |
| pntxt | resulting plaintext buffer |
Definition at line 666 of file encryption.c.
References AES_setkey, BLOCKSIZE, BURN, M_DECRYPTION_ERROR, M_SUCCESS, rijndaelDecrypt(), RoundKey, and SPP_EXTERNAL_ENCRYPTION_ecbDecrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_ecbDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_cbcEncrypt | ( | const uint8_t * | key, |
| const uint8_t | iVec[16], | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
References SPP_EXTERNAL_ENCRYPTION_cbcEncrypt().
| char SPP_EXTERNAL_ENCRYPTION_cbcDecrypt | ( | const uint8_t * | key, |
| const uint8_t | iVec[16], | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
| void SPP_EXTERNAL_ENCRYPTION_cfbEncrypt | ( | const uint8_t * | key, |
| const uint8_t | iVec[16], | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
References SPP_EXTERNAL_ENCRYPTION_cfbEncrypt().
| void SPP_EXTERNAL_ENCRYPTION_cfbDecrypt | ( | const uint8_t * | key, |
| const uint8_t | iVec[16], | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
| void SPP_EXTERNAL_ENCRYPTION_ofbEncrypt | ( | const uint8_t * | key, |
| const uint8_t | iVec[16], | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
References SPP_EXTERNAL_ENCRYPTION_ofbEncrypt().
| void SPP_EXTERNAL_ENCRYPTION_ofbDecrypt | ( | const uint8_t * | key, |
| const uint8_t | iVec[16], | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
References SPP_EXTERNAL_ENCRYPTION_ctrDecrypt(), SPP_EXTERNAL_ENCRYPTION_ctrEncrypt(), SPP_EXTERNAL_ENCRYPTION_ofbDecrypt(), SPP_EXTERNAL_ENCRYPTION_xtsDecrypt(), and SPP_EXTERNAL_ENCRYPTION_xtsEncrypt().
| char SPP_EXTERNAL_ENCRYPTION_xtsEncrypt | ( | const uint8_t * | keys, |
| const uint8_t * | tweak, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
encrypt the input plaintext using XTS-AES block-cipher method
| keys | two-part encryption key with a fixed size of 2*KEYSIZE |
| tweak | tweak bytes of data unit, a.k.a sector ID (little-endian) |
| pntxt | input plaintext buffer |
| ptextLen | size of plaintext in bytes |
| crtxt | resulting cipher-text buffer |
Definition at line 1073 of file encryption.c.
References SPP_EXTERNAL_ENCRYPTION_xtsEncrypt(), and XTS_cipher().
Referenced by SPP_EXTERNAL_ENCRYPTION_ofbDecrypt(), and SPP_EXTERNAL_ENCRYPTION_xtsEncrypt().
| char SPP_EXTERNAL_ENCRYPTION_xtsDecrypt | ( | const uint8_t * | keys, |
| const uint8_t * | tweak, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
encrypt the input ciphertext using XTS-AES block-cipher method
| keys | two-part encryption key with a fixed size of 2*KEYSIZE |
| tweak | tweak bytes of data unit, a.k.a sector ID (little-endian) |
| crtxt | input ciphertext buffer |
| crtxtLen | size of ciphertext in bytes |
| pntxt | resulting plaintext buffer |
Definition at line 1089 of file encryption.c.
References SPP_EXTERNAL_ENCRYPTION_xtsDecrypt(), and XTS_cipher().
Referenced by SPP_EXTERNAL_ENCRYPTION_ofbDecrypt(), and SPP_EXTERNAL_ENCRYPTION_xtsDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_ctrEncrypt | ( | const uint8_t * | key, |
| const uint8_t * | iv, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
encrypt the input plaintext using CTR-AES block-cipher method
| key | encryption key with a fixed size specified by KEYSIZE |
| iv | initialization vector a.k.a. nonce |
| pntxt | input plaintext buffer |
| ptextLen | size of plaintext in bytes |
| crtxt | resulting cipher-text buffer |
Definition at line 965 of file encryption.c.
References AES_setkey, BURN, CTR_cipher(), CTR_DEFAULT, CTR_IV_LENGTH, CTR_START_VALUE, LAST, RoundKey, SPP_EXTERNAL_ENCRYPTION_ctrEncrypt(), and xorBEint().
Referenced by SPP_EXTERNAL_ENCRYPTION_ctrDecrypt(), SPP_EXTERNAL_ENCRYPTION_ctrEncrypt(), and SPP_EXTERNAL_ENCRYPTION_ofbDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_ctrDecrypt | ( | const uint8_t * | key, |
| const uint8_t * | iv, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
decrypt the input ciphertext using CTR-AES block-cipher method
| key | decryption key with a fixed size specified by KEYSIZE |
| iv | initialization vector a.k.a. nonce |
| crtxt | input ciphertext buffer |
| crtxtLen | size of ciphertext in bytes |
| pntxt | resulting plaintext buffer |
Definition at line 989 of file encryption.c.
References SPP_EXTERNAL_ENCRYPTION_ctrDecrypt(), and SPP_EXTERNAL_ENCRYPTION_ctrEncrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_ctrDecrypt(), and SPP_EXTERNAL_ENCRYPTION_ofbDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_sivEncrypt | ( | const uint8_t * | keys, |
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| uint8_t | iv[16], | ||
| void * | crtxt ) |
References SPP_EXTERNAL_ENCRYPTION_sivEncrypt().
| char SPP_EXTERNAL_ENCRYPTION_sivDecrypt | ( | const uint8_t * | keys, |
| const uint8_t | iv[16], | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
References EAXP, SPP_EXTERNAL_ENCRYPTION_ccmDecrypt(), SPP_EXTERNAL_ENCRYPTION_ccmEncrypt(), SPP_EXTERNAL_ENCRYPTION_eaxDecrypt(), SPP_EXTERNAL_ENCRYPTION_eaxEncrypt(), SPP_EXTERNAL_ENCRYPTION_gcmDecrypt(), SPP_EXTERNAL_ENCRYPTION_gcmEncrypt(), SPP_EXTERNAL_ENCRYPTION_gcmSivDecrypt(), SPP_EXTERNAL_ENCRYPTION_gcmSivEncrypt(), SPP_EXTERNAL_ENCRYPTION_keyUnwrap(), SPP_EXTERNAL_ENCRYPTION_keyWrap(), SPP_EXTERNAL_ENCRYPTION_ocbDecrypt(), SPP_EXTERNAL_ENCRYPTION_ocbEncrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_gcmEncrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
encrypt the input plaintext using GCM-AES block-cipher method
| key | encryption key with a fixed size specified by KEYSIZE |
| nonce | a.k.a initialization vector with fixed size: GCM_NONCE_LEN |
| aData | additional authentication data |
| aDataLen | size of additional authentication data |
| pntxt | input plain-text buffer |
| ptextLen | size of plaintext in bytes |
| crtxt | resulting cipher-text buffer + message authentication tag |
Definition at line 1165 of file encryption.c.
References BURN, CCM_GCM, CTR_cipher(), GCM_TAG_LEN, GCMsetup(), gHash(), rijndaelEncrypt(), RoundKey, SPP_EXTERNAL_ENCRYPTION_gcmEncrypt(), and xorBlock().
Referenced by SPP_EXTERNAL_ENCRYPTION_CYPHER_encryptPacket(), SPP_EXTERNAL_ENCRYPTION_gcmEncrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_gcmDecrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
decrypt the input ciphertext using GCM-AES block-cipher method
| key | decryption key with a fixed size specified by KEYSIZE |
| nonce | a.k.a initialization vector with fixed size: GCM_NONCE_LEN |
| aData | additional authentication data |
| aDataLen | size of additional authentication data |
| crtxt | input cipher-text buffer + appended authentication tag |
| crtxtLen | size of ciphertext, excluding tag |
| pntxt | resulting plaintext buffer |
Definition at line 1193 of file encryption.c.
References BURN, CCM_GCM, CTR_cipher(), GCM_TAG_LEN, GCMsetup(), gHash(), M_AUTHENTICATION_ERROR, M_SUCCESS, memcmp_s, rijndaelEncrypt(), RoundKey, SPP_EXTERNAL_ENCRYPTION_gcmDecrypt(), and xorBlock().
Referenced by SPP_EXTERNAL_ENCRYPTION_gcmDecrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_ccmEncrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
encrypt the input plaintext using CCM-AES block-cipher method
| key | encryption key with a fixed size specified by KEYSIZE |
| nonce | a.k.a initialization vector with fixed size: CCM_NONCE_LEN |
| aData | additional authentication data |
| aDataLen | size of additional authentication data |
| pntxt | input plain-text buffer |
| ptextLen | size of plaintext in bytes |
| crtxt | resulting cipher-text buffer + message authentication tag |
Definition at line 1269 of file encryption.c.
References AES_setkey, BURN, CCM_GCM, CCM_NONCE_LEN, CCM_TAG_LEN, CCMtag(), CTR_cipher(), RoundKey, and SPP_EXTERNAL_ENCRYPTION_ccmEncrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_ccmEncrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_ccmDecrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
decrypt the input ciphertext using CCM-AES block-cipher method
| key | decryption key with a fixed size specified by KEYSIZE |
| nonce | a.k.a initialization vector with fixed size: CCM_NONCE_LEN |
| aData | additional authentication data |
| aDataLen | size of additional authentication data |
| crtxt | input cipher-text buffer + appended authentication tag |
| crtxtLen | size of ciphertext, excluding tag |
| pntxt | resulting plaintext buffer |
Definition at line 1296 of file encryption.c.
References AES_setkey, BURN, CCM_GCM, CCM_NONCE_LEN, CCM_TAG_LEN, CCMtag(), CTR_cipher(), M_AUTHENTICATION_ERROR, M_SUCCESS, memcmp_s, RoundKey, SABOTAGE, and SPP_EXTERNAL_ENCRYPTION_ccmDecrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_ccmDecrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_ocbEncrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
encrypt the input stream using OCB-AES block-cipher method
| key | encryption key with a fixed size specified by KEYSIZE |
| nonce | a.k.a initialization vector with fixed size: OCB_NONCE_LEN |
| aData | additional authentication data |
| aDataLen | size of additional authentication data |
| pntxt | input plain-text buffer |
| ptextLen | size of plaintext in bytes |
| crtxt | resulting cipher-text buffer + message authentication tag |
Definition at line 1773 of file encryption.c.
References OCB_cipher(), OCB_TAG_LEN, and SPP_EXTERNAL_ENCRYPTION_ocbEncrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_ocbEncrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_ocbDecrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
decrypt the input stream using OCB-AES block-cipher method
| key | decryption key with a fixed size specified by KEYSIZE |
| nonce | a.k.a initialization vector with fixed size: OCB_NONCE_LEN |
| aData | additional authentication data |
| aDataLen | size of additional authentication data |
| crtxt | input cipher-text buffer + appended authentication tag |
| crtxtLen | size of ciphertext, excluding tag |
| pntxt | resulting plaintext buffer |
Definition at line 1796 of file encryption.c.
References M_AUTHENTICATION_ERROR, M_SUCCESS, memcmp_s, OCB_cipher(), OCB_TAG_LEN, SABOTAGE, and SPP_EXTERNAL_ENCRYPTION_ocbDecrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_ocbDecrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_eaxEncrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
encrypt the input plaintext using EAX-AES block-cipher method
| key | encryption key with a fixed size specified by KEYSIZE |
| nonce | nonce with variable size in EAX' and fixed size in EAX |
| nonceLen | size of the nonce byte array; should be non-zero in EAX' |
| aData | additional authentication data; used in EAX only |
| aDataLen | size of additional authentication data |
| pntxt | input plain-text buffer |
| ptextLen | size of plaintext in bytes |
| crtxt | ciphertext result + auth. tag (4 bytes mac in EAX') |
Definition at line 1557 of file encryption.c.
References BURN, COPYDWORD, CTR_cipher(), CTR_DEFAULT, doubleBblock(), doubleLblock(), EAX_NONCE_LEN, EAX_TAG_LEN, EAXP, getSubkeys(), oMac(), RoundKey, SPP_EXTERNAL_ENCRYPTION_eaxEncrypt(), XOR32BITS, and xorBlock().
Referenced by SPP_EXTERNAL_ENCRYPTION_eaxEncrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_eaxDecrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
decrypt the input ciphertext using EAX-AES block-cipher method
| key | decryption key with a fixed size specified by KEYSIZE |
| nonce | nonce with variable size in EAX' and fixed size in EAX |
| nonceLen | size of the nonce byte array; only used in EAX' |
| aData | additional authentication data; for EAX only, not EAX' |
| aDataLen | size of additional authentication data |
| crtxt | input cipher-text buffer + appended authentication tag |
| crtxtLen | size of cipher-text; excluding tag / 4-bytes mac in EAX' |
| pntxt | resulting plaintext buffer |
Definition at line 1607 of file encryption.c.
References BURN, CTR_cipher(), CTR_DEFAULT, doubleBblock(), doubleLblock(), EAX_NONCE_LEN, EAX_TAG_LEN, EAXP, getSubkeys(), M_AUTHENTICATION_ERROR, M_SUCCESS, memcmp_s, oMac(), RoundKey, SPP_EXTERNAL_ENCRYPTION_eaxDecrypt(), XOR32BITS, and xorBlock().
Referenced by SPP_EXTERNAL_ENCRYPTION_eaxDecrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_gcmSivEncrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
encrypt the input plaintext using SIV-GCM-AES block-cipher method
| key | encryption key with a fixed size specified by KEYSIZE |
| nonce | provided 96-bit nonce |
| aData | additional authentication data |
| aDataLen | size of additional authentication data |
| pntxt | input plain-text buffer |
| ptextLen | size of plaintext in bytes |
| crtxt | resulting cipher-text buffer + message authentication tag |
Definition at line 1470 of file encryption.c.
References BURN, CTR_cipher(), GCM_SIVsetup(), GCM_SIVtag(), polyval(), RoundKey, SIVGCM_CTR, and SPP_EXTERNAL_ENCRYPTION_gcmSivEncrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_gcmSivEncrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_gcmSivDecrypt | ( | const uint8_t * | key, |
| const uint8_t * | nonce, | ||
| const void * | aData, | ||
| const size_t | aDataLen, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
decrypt the input ciphertext using SIV-GCM-AES block-cipher method
| key | decryption key with a fixed size specified by KEYSIZE |
| nonce | provided 96-bit nonce |
| aData | additional authentication data |
| aDataLen | size of additional authentication data |
| crtxt | input cipher-text buffer + appended authentication tag |
| crtxtLen | size of ciphertext, excluding tag |
| pntxt | resulting plaintext buffer |
Definition at line 1496 of file encryption.c.
References BURN, CTR_cipher(), GCM_SIVsetup(), GCM_SIVtag(), M_AUTHENTICATION_ERROR, M_SUCCESS, memcmp_s, polyval(), RoundKey, SABOTAGE, SIVGCM_CTR, SIVGCM_TAG_LEN, and SPP_EXTERNAL_ENCRYPTION_gcmSivDecrypt().
Referenced by SPP_EXTERNAL_ENCRYPTION_gcmSivDecrypt(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_keyWrap | ( | const uint8_t * | kek, |
| const void * | secret, | ||
| const size_t | secretLen, | ||
| void * | wrapped ) |
encrypt the input secret with key-wrapping method
| kek | key-encryption-key a.k.a master key |
| secret | input plaintext secret |
| secretLen | size of secret in bytes |
| wrapped | wrapped secret, prepended with an additional half-block |
Definition at line 1829 of file encryption.c.
References AES_setkey, BURN, HB, IV_KWA, M_DATALENGTH_ERROR, M_SUCCESS, MIDST, rijndaelEncrypt(), RoundKey, SPP_EXTERNAL_ENCRYPTION_keyWrap(), and xorBEint().
Referenced by SPP_EXTERNAL_ENCRYPTION_keyWrap(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_keyUnwrap | ( | const uint8_t * | kek, |
| const void * | wrapped, | ||
| const size_t | wrapLen, | ||
| void * | secret ) |
unwrap/decrypt a wrapped secret according to RFC-3394
| kek | key-encryption-key a.k.a master key |
| wrapped | ciphertext input, the wrapped secret |
| wrapLen | size of ciphertext/wrapped input in bytes |
| secret | unwrapped secret, which is a half block shorter than input |
Definition at line 1865 of file encryption.c.
References AES_setkey, BURN, HB, IV_KWA, M_AUTHENTICATION_ERROR, M_DATALENGTH_ERROR, M_SUCCESS, memcmp_s, MIDST, rijndaelDecrypt(), RoundKey, SABOTAGE, SPP_EXTERNAL_ENCRYPTION_keyUnwrap(), and xorBEint().
Referenced by SPP_EXTERNAL_ENCRYPTION_keyUnwrap(), and SPP_EXTERNAL_ENCRYPTION_sivDecrypt().
| char SPP_EXTERNAL_ENCRYPTION_fpeEncrypt | ( | const uint8_t * | key, |
| const uint8_t * | tweak, | ||
| const size_t | tweakLen, | ||
| const void * | pntxt, | ||
| const size_t | ptextLen, | ||
| void * | crtxt ) |
References FF_X, and SPP_EXTERNAL_ENCRYPTION_fpeEncrypt().
| char SPP_EXTERNAL_ENCRYPTION_fpeDecrypt | ( | const uint8_t * | key, |
| const uint8_t * | tweak, | ||
| const size_t | tweakLen, | ||
| const void * | crtxt, | ||
| const size_t | crtxtLen, | ||
| void * | pntxt ) |
References FF_X, and SPP_EXTERNAL_ENCRYPTION_fpeDecrypt().
| void SPP_EXTERNAL_ENCRYPTION_poly1305 | ( | const uint8_t * | keys, |
| const uint8_t | nonce[16], | ||
| const void * | data, | ||
| const size_t | dataSize, | ||
| uint8_t | mac[16] ) |
References SPP_EXTERNAL_ENCRYPTION_poly1305().
| void SPP_EXTERNAL_ENCRYPTION_cmac | ( | const uint8_t * | key, |
| const void * | data, | ||
| const size_t | dataSize, | ||
| uint8_t | mac[16] ) |
References SPP_EXTERNAL_ENCRYPTION_cmac().