/** * (c) Copyright, Real-Time Innovations, 2014-2016. * All rights reserved. * No duplications, whole or partial, manual or electronic, may be made * without express written permission. Any such copies, or * revisions thereof, must display this notice unaltered. * This code contains trade secrets of Real-Time Innovations, Inc. * * Description * ----------- * Default create functions for security plugins * ===================================================================== */ #ifndef security_cryptography_h #define security_cryptography_h #ifndef security_infrastructure_h #include "security/security_infrastructure.h" #endif #ifdef __cplusplus extern "C" { #endif #define DDS_SecureSubmessage_INVALID \ DDS_TrustedSubmessage_INVALID #define DDS_SecureSubmessage_INFO_SUBMESSAGE \ DDS_TrustedSubmessage_INFO_SUBMESSAGE #define DDS_SecureSubmessage_DATAWRITER_SUBMESSAGE \ DDS_TrustedSubmessage_DATAWRITER_SUBMESSAGE #define DDS_SecureSubmessage_DATAREADER_SUBMESSAGE \ DDS_TrustedSubmessage_DATAREADER_SUBMESSAGE typedef DDS_TrustedSubmessageCategory_t DDS_SecureSubmessageCategory_t; /* * According to * https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf , * 8.3 Constraints on the Number of Invocations, there's a 2^32 limit for max * invocations per key *unless* we use 96-bit IVs that are deterministically * constructed. Our IVs do fit that description. According to the DDS Security * specification, "Computation of ciphertext from plaintext", the encryption * operation uses a 96-bit initialization vector constructed as: * * InitializationVector = SessionId | InitializationVectorSuffix * * According to the DDS Security specification, the SessionId is 4 bytes and * the InitializationVectorSuffix is 8 bytes. The SessionId stays the same * throughout the session. The InitializationVectorSuffix is initially random, * but since the InitializationVector is "incremented each time any of those * keys are used", InitializationVectorSuffix must be incremented with each * invocation. So the IV is deterministically constructed. We construct it that * way in our implementation. So this 2^32 limit doesn't apply to us. Our * default limit is 2^64 - 1. So after 2^64 - 1 invocations of the same * "session" key material, which is derived from the "master" key material and * the SessionId, we will increment the SessionId and derive new "session" key * material from the same "master" key material. The "master" key material is * randomly generated for each DDS entity at the time you create the entity. */ #define RTI_SECURITY_MAX_BLOCKS_PER_SESSION_PROPERTY_DEFAULT 0xffffffffffffffffULL #define RTI_SECURITY_CRYPTOGRAPHY_CIPHER_ALGO_AUTO "AUTO" #define RTI_SECURITY_CRYPTOGRAPHY_CIPHER_ALGO_AES_128 "AES128+GCM" #define RTI_SECURITY_CRYPTOGRAPHY_CIPHER_ALGO_AES_256 "AES256+GCM" #define RTI_SECURITY_CRYPTOGRAPHY_CIPHER_ALGO_SM4 "SM4+GCM" /* key 16 bytes, IV 12 bytes */ #define RTI_SECURITY_CRYPTOGRAPHY_CIPHER_ALGO_AES_128_LEGACY "aes-128-gcm" /* key 32 bytes, IV 12 bytes */ #define RTI_SECURITY_CRYPTOGRAPHY_CIPHER_ALGO_AES_256_LEGACY "aes-256-gcm" #define RTI_SECURITY_MAX_RECEIVER_SPECIFIC_MACS_PROPERTY_AUTO -1 #define RTI_SECURITY_MAX_RECEIVER_SPECIFIC_MACS_PROPERTY_MIN \ RTI_SECURITY_MAX_RECEIVER_SPECIFIC_MACS_PROPERTY_AUTO #define RTI_SECURITY_MAX_RECEIVER_SPECIFIC_MACS_PROPERTY_DEFAULT \ RTI_SECURITY_MAX_RECEIVER_SPECIFIC_MACS_PROPERTY_AUTO /* 3275 = 65507 (UDPv4 message_size_max) / 20 (sizeof(ReceiverSpecificMAC)). */ #define RTI_SECURITY_MAX_RECEIVER_SPECIFIC_MACS_PROPERTY_MAX 3275 #define RTI_SECURITY_KEY_REVISION_MAX_HISTORY_DEPTH_PROPERTY_MAX 1000000 #define RTI_SECURITY_SHARE_KEY_FOR_METADATA_AND_DATA_PROTECTION_PROPERTY_DEFAULT \ RTI_TRUE /* * according to https://wiki.openssl.org/index.php/EVP_Authenticated_ * Encryption_and_Decryption */ #define RTI_SECURITY_AES_GCM_TAG_LENGTH 16 #ifdef __cplusplus } /* extern "C" */ #endif #endif /* security_cryptography_h */