| OLD | NEW |
| 1 /* | 1 /* |
| 2 * aes_icm.h | 2 * aes_icm.h |
| 3 * | 3 * |
| 4 * Header for AES Integer Counter Mode. | 4 * Header for AES Integer Counter Mode. |
| 5 * | 5 * |
| 6 * David A. McGrew | 6 * David A. McGrew |
| 7 * Cisco Systems, Inc. | 7 * Cisco Systems, Inc. |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 /* | 10 /* |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 42 * OF THE POSSIBILITY OF SUCH DAMAGE. | 42 * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 43 * | 43 * |
| 44 */ | 44 */ |
| 45 | 45 |
| 46 #ifndef AES_ICM_H | 46 #ifndef AES_ICM_H |
| 47 #define AES_ICM_H | 47 #define AES_ICM_H |
| 48 | 48 |
| 49 #include "cipher.h" | 49 #include "cipher.h" |
| 50 #include "datatypes.h" |
| 50 #include <openssl/evp.h> | 51 #include <openssl/evp.h> |
| 51 #include <openssl/aes.h> | 52 #include <openssl/aes.h> |
| 52 | 53 |
| 53 #ifdef OPENSSL_IS_BORINGSSL | 54 #define SRTP_SALT_SIZE 14 |
| 54 // BoringSSL doesn't support AES-192, cipher will be disabled | 55 #define SRTP_AES_128_KEYSIZE AES_BLOCK_SIZE |
| 55 #define SRTP_NO_AES192 | 56 #define SRTP_AES_256_KEYSIZE AES_BLOCK_SIZE * 2 |
| 56 #endif | 57 #define SRTP_AES_128_KEYSIZE_WSALT SRTP_AES_128_KEYSIZE + SRTP_SALT_SIZE |
| 57 | 58 #define SRTP_AES_256_KEYSIZE_WSALT SRTP_AES_256_KEYSIZE + SRTP_SALT_SIZE |
| 58 #define SALT_SIZE 14 | 59 #define SRTP_AES_192_KEYSIZE AES_BLOCK_SIZE + AES_BLOCK_SIZE / 2 |
| 59 #define AES_128_KEYSIZE AES_BLOCK_SIZE | 60 #define SRTP_AES_192_KEYSIZE_WSALT SRTP_AES_192_KEYSIZE + SRTP_SALT_SIZE |
| 60 #ifndef SRTP_NO_AES192 | |
| 61 #define AES_192_KEYSIZE AES_BLOCK_SIZE + AES_BLOCK_SIZE / 2 | |
| 62 #endif | |
| 63 #define AES_256_KEYSIZE AES_BLOCK_SIZE * 2 | |
| 64 #define AES_128_KEYSIZE_WSALT AES_128_KEYSIZE + SALT_SIZE | |
| 65 #ifndef SRTP_NO_AES192 | |
| 66 #define AES_192_KEYSIZE_WSALT AES_192_KEYSIZE + SALT_SIZE | |
| 67 #endif | |
| 68 #define AES_256_KEYSIZE_WSALT AES_256_KEYSIZE + SALT_SIZE | |
| 69 | 61 |
| 70 typedef struct { | 62 typedef struct { |
| 71 v128_t counter; /* holds the counter value */ | 63 v128_t counter; /* holds the counter value */ |
| 72 v128_t offset; /* initial offset value */ | 64 v128_t offset; /* initial offset value */ |
| 73 v256_t key; | |
| 74 int key_size; | 65 int key_size; |
| 75 EVP_CIPHER_CTX ctx; | 66 EVP_CIPHER_CTX* ctx; |
| 76 } aes_icm_ctx_t; | 67 } srtp_aes_icm_ctx_t; |
| 77 | |
| 78 err_status_t aes_icm_openssl_set_iv(aes_icm_ctx_t *c, void *iv, int dir); | |
| 79 err_status_t aes_icm_openssl_context_init(aes_icm_ctx_t *c, const uint8_t *key,
int len); | |
| 80 err_status_t aes_icm_output(aes_icm_ctx_t *c, uint8_t *buffer, int num_octets_to
_output); | |
| 81 uint16_t aes_icm_bytes_encrypted(aes_icm_ctx_t *c); | |
| 82 | |
| 83 | 68 |
| 84 #endif /* AES_ICM_H */ | 69 #endif /* AES_ICM_H */ |
| 85 | 70 |
| OLD | NEW |