![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|


Go to the source code of this file.
Classes | |
| struct | cipherInstance |
| struct | keyInstance |
Macros | |
| #define | BAD_BLOCK_LENGTH -6 |
| #define | BAD_CIPHER_INSTANCE -7 |
| #define | BAD_CIPHER_MODE -4 /* Params struct passed to cipherInit invalid */ |
| #define | BAD_CIPHER_STATE -5 /* Cipher in wrong state (e.g., not initialized) */ |
| #define | BAD_DATA -8 /* Data contents are invalid, e.g., invalid padding */ |
| #define | BAD_KEY_DIR -1 /* Key direction is invalid, e.g., unknown value */ |
| #define | BAD_KEY_INSTANCE -3 /* Key passed is not valid */ |
| #define | BAD_KEY_MAT -2 /* Key material not of correct length */ |
| #define | BAD_OTHER -9 /* Unknown error */ |
| #define | BITSPERBLOCK 128 /* Default number of bits in a cipher block */ |
| #define | DIR_DECRYPT 1 /* Are we decrpyting? */ |
| #define | DIR_ENCRYPT 0 /* Are we encrpyting? */ |
| #define | FALSE 0 |
| #define | MAX_IV_SIZE 16 /* # bytes needed to represent an IV */ |
| #define | MAX_KEY_SIZE 64 /* # of ASCII char's needed to represent a key */ |
| #define | MODE_CBC 2 /* Are we ciphering in CBC mode? */ |
| #define | MODE_CFB1 3 /* Are we ciphering in 1-bit CFB mode? */ |
| #define | MODE_ECB 1 /* Are we ciphering in ECB mode? */ |
| #define | TRUE 1 |
Typedefs | |
| typedef unsigned char | BYTE |
Functions | |
| int | blockDecrypt (cipherInstance *cipher, keyInstance *key, BYTE *input, int inputLen, BYTE *outBuffer) |
| int | blockEncrypt (cipherInstance *cipher, keyInstance *key, BYTE *input, int inputLen, BYTE *outBuffer) |
| int | cipherInit (cipherInstance *cipher, BYTE mode, char *IV) |
| int | cipherUpdateRounds (cipherInstance *cipher, keyInstance *key, BYTE *input, int inputLen, BYTE *outBuffer, int Rounds) |
| int | makeKey (keyInstance *key, BYTE direction, int keyLen, const char *keyMaterial) |
| int | padDecrypt (cipherInstance *cipher, keyInstance *key, BYTE *input, int inputOctets, BYTE *outBuffer) |
| int | padEncrypt (cipherInstance *cipher, keyInstance *key, BYTE *input, int inputOctets, BYTE *outBuffer) |
| #define BAD_BLOCK_LENGTH -6 |
Definition at line 60 of file crypt_aes.h.
| #define BAD_CIPHER_INSTANCE -7 |
Definition at line 61 of file crypt_aes.h.
Referenced by cipherInit().
| #define BAD_CIPHER_MODE -4 /* Params struct passed to cipherInit invalid */ |
Definition at line 58 of file crypt_aes.h.
Referenced by cipherInit().
| #define BAD_CIPHER_STATE -5 /* Cipher in wrong state (e.g., not initialized) */ |
Definition at line 59 of file crypt_aes.h.
Referenced by blockDecrypt(), blockEncrypt(), cipherUpdateRounds(), padDecrypt(), and padEncrypt().
| #define BAD_DATA -8 /* Data contents are invalid, e.g., invalid padding */ |
Definition at line 62 of file crypt_aes.h.
Referenced by padDecrypt().
| #define BAD_KEY_DIR -1 /* Key direction is invalid, e.g., unknown value */ |
Definition at line 55 of file crypt_aes.h.
Referenced by cipherUpdateRounds(), and makeKey().
| #define BAD_KEY_INSTANCE -3 /* Key passed is not valid */ |
Definition at line 57 of file crypt_aes.h.
Referenced by makeKey().
| #define BAD_KEY_MAT -2 /* Key material not of correct length */ |
Definition at line 56 of file crypt_aes.h.
Referenced by makeKey().
| #define BAD_OTHER -9 /* Unknown error */ |
Definition at line 63 of file crypt_aes.h.
| #define BITSPERBLOCK 128 /* Default number of bits in a cipher block */ |
Definition at line 52 of file crypt_aes.h.
| #define DIR_DECRYPT 1 /* Are we decrpyting? */ |
Definition at line 46 of file crypt_aes.h.
Referenced by blockEncrypt(), cipherUpdateRounds(), makeKey(), makeMCTs(), padEncrypt(), rijndael_initialize(), rijndaelIVKAT(), rijndaelTKAT(), and rijndaelVKKAT().
| #define DIR_ENCRYPT 0 /* Are we encrpyting? */ |
rijndael-api-fst.h
Optimised ANSI C code for the Rijndael cipher (now AES)
This code is hereby placed in the public domain.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Acknowledgements:
We are deeply indebted to the following people for their bug reports, fixes, and improvement suggestions to this implementation. Though we tried to list all contributions, we apologise in advance for any missing reference.
Andrew Bales Andre.nosp@m.w.Ba.nosp@m.les@H.nosp@m.oney.nosp@m.well..nosp@m.com Markus Friedl marku.nosp@m.s.fr.nosp@m.iedl@.nosp@m.info.nosp@m.rmati.nosp@m.k.un.nosp@m.i-erl.nosp@m.ange.nosp@m.n.de John Skodon skodo.nosp@m.nj@w.nosp@m.ebqui.nosp@m.ll.c.nosp@m.om
Definition at line 45 of file crypt_aes.h.
Referenced by blockDecrypt(), cipherUpdateRounds(), makeKey(), makeMCTs(), padDecrypt(), rijndael_initialize(), rijndaelCBC_MCT(), rijndaelECB_MCT(), rijndaelIVKAT(), rijndaelTKAT(), rijndaelVKKAT(), and rijndaelVTKAT().
| #define FALSE 0 |
Definition at line 51 of file crypt_aes.h.
| #define MAX_IV_SIZE 16 /* # bytes needed to represent an IV */ |
Definition at line 67 of file crypt_aes.h.
Referenced by cipherInit().
| #define MAX_KEY_SIZE 64 /* # of ASCII char's needed to represent a key */ |
Definition at line 66 of file crypt_aes.h.
| #define MODE_CBC 2 /* Are we ciphering in CBC mode? */ |
Definition at line 48 of file crypt_aes.h.
Referenced by blockDecrypt(), blockEncrypt(), cipherInit(), padDecrypt(), and padEncrypt().
| #define MODE_CFB1 3 /* Are we ciphering in 1-bit CFB mode? */ |
Definition at line 49 of file crypt_aes.h.
Referenced by blockDecrypt(), blockEncrypt(), and cipherInit().
| #define MODE_ECB 1 /* Are we ciphering in ECB mode? */ |
Definition at line 47 of file crypt_aes.h.
Referenced by blockDecrypt(), blockEncrypt(), cipherInit(), padDecrypt(), padEncrypt(), rijndael_initialize(), rijndaelCBC_MCT(), rijndaelECB_MCT(), rijndaelIVKAT(), rijndaelTKAT(), rijndaelVKKAT(), and rijndaelVTKAT().
| #define TRUE 1 |
Definition at line 50 of file crypt_aes.h.
| typedef unsigned char BYTE |
Definition at line 71 of file crypt_aes.h.
| int blockDecrypt | ( | cipherInstance * | cipher, |
| keyInstance * | key, | ||
| BYTE * | input, | ||
| int | inputLen, | ||
| BYTE * | outBuffer ) |
Definition at line 287 of file crypt_aes.c.
References BAD_CIPHER_STATE, DIR_ENCRYPT, cipherInstance::IV, key, cipherInstance::mode, MODE_CBC, MODE_CFB1, MODE_ECB, rijndaelDecrypt(), and rijndaelEncrypt().
Referenced by rijndael_decrypt(), rijndaelCBC_MCT(), rijndaelECB_MCT(), rijndaelTKAT(), and rijndaelVKKAT().

| int blockEncrypt | ( | cipherInstance * | cipher, |
| keyInstance * | key, | ||
| BYTE * | input, | ||
| int | inputLen, | ||
| BYTE * | outBuffer ) |
Definition at line 145 of file crypt_aes.c.
References BAD_CIPHER_STATE, DIR_DECRYPT, cipherInstance::IV, key, cipherInstance::mode, MODE_CBC, MODE_CFB1, MODE_ECB, and rijndaelEncrypt().
Referenced by rijndael_encrypt(), rijndaelCBC_MCT(), rijndaelECB_MCT(), rijndaelTKAT(), rijndaelVKKAT(), and rijndaelVTKAT().

| int cipherInit | ( | cipherInstance * | cipher, |
| BYTE | mode, | ||
| char * | IV ) |
Definition at line 105 of file crypt_aes.c.
References BAD_CIPHER_INSTANCE, BAD_CIPHER_MODE, cipherInstance::IV, MAX_IV_SIZE, cipherInstance::mode, mode, MODE_CBC, MODE_CFB1, MODE_ECB, and TRUE.
Referenced by rijndael_initialize(), rijndaelCBC_MCT(), rijndaelECB_MCT(), rijndaelIVKAT(), rijndaelTKAT(), rijndaelVKKAT(), and rijndaelVTKAT().
| int cipherUpdateRounds | ( | cipherInstance * | cipher, |
| keyInstance * | key, | ||
| BYTE * | input, | ||
| int | inputLen, | ||
| BYTE * | outBuffer, | ||
| int | rounds ) |
cipherUpdateRounds:
Encrypts/Decrypts exactly one full block a specified number of rounds. Only used in the Intermediate Value Known Answer Test.
Returns: TRUE - on success BAD_CIPHER_STATE - cipher in bad state (e.g., not initialized)
Definition at line 444 of file crypt_aes.c.
References BAD_CIPHER_STATE, BAD_KEY_DIR, DIR_DECRYPT, DIR_ENCRYPT, key, rijndaelDecryptRound(), rijndaelEncryptRound(), TRUE, and UNUSED.
Referenced by rijndaelIVKAT().

| int makeKey | ( | keyInstance * | key, |
| BYTE | direction, | ||
| int | keyLen, | ||
| const char * | keyMaterial ) |
rijndael-api-fst.c
Optimised ANSI C code for the Rijndael cipher (now AES)
This code is hereby placed in the public domain.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Acknowledgements:
We are deeply indebted to the following people for their bug reports, fixes, and improvement suggestions to this implementation. Though we tried to list all contributions, we apologise in advance for any missing reference.
Andrew Bales Andre.nosp@m.w.Ba.nosp@m.les@H.nosp@m.oney.nosp@m.well..nosp@m.com Markus Friedl marku.nosp@m.s.fr.nosp@m.iedl@.nosp@m.info.nosp@m.rmati.nosp@m.k.un.nosp@m.i-erl.nosp@m.ange.nosp@m.n.de John Skodon skodo.nosp@m.nj@w.nosp@m.ebqui.nosp@m.ll.c.nosp@m.om
Definition at line 45 of file crypt_aes.c.
References BAD_KEY_DIR, BAD_KEY_INSTANCE, BAD_KEY_MAT, DIR_DECRYPT, DIR_ENCRYPT, key, MAXKB, rijndaelKeySetupDec(), rijndaelKeySetupEnc(), and TRUE.
Referenced by rijndael_initialize(), rijndaelCBC_MCT(), rijndaelECB_MCT(), rijndaelIVKAT(), rijndaelTKAT(), rijndaelVKKAT(), and rijndaelVTKAT().

| int padDecrypt | ( | cipherInstance * | cipher, |
| keyInstance * | key, | ||
| BYTE * | input, | ||
| int | inputOctets, | ||
| BYTE * | outBuffer ) |
Definition at line 356 of file crypt_aes.c.
References BAD_CIPHER_STATE, BAD_DATA, DIR_ENCRYPT, cipherInstance::IV, key, cipherInstance::mode, MODE_CBC, MODE_ECB, and rijndaelDecrypt().

| int padEncrypt | ( | cipherInstance * | cipher, |
| keyInstance * | key, | ||
| BYTE * | input, | ||
| int | inputOctets, | ||
| BYTE * | outBuffer ) |
Encrypt data partitioned in octets, using RFC 2040-like padding.
| input | data to be encrypted (octet sequence) |
| inputOctets | input length in octets (not bits) |
| outBuffer | encrypted output data |
Definition at line 224 of file crypt_aes.c.
References BAD_CIPHER_STATE, DIR_DECRYPT, cipherInstance::IV, key, cipherInstance::mode, MODE_CBC, MODE_ECB, and rijndaelEncrypt().
