| 2092 | } |
| 2093 | |
| 2094 | bool CryptoBuiltInImpl::decode_submessage( |
| 2095 | DDS::OctetSeq& plain_rtps_submessage, |
| 2096 | const DDS::OctetSeq& encoded_rtps_submessage, |
| 2097 | NativeCryptoHandle sender_handle, |
| 2098 | SecurityException& ex) |
| 2099 | { |
| 2100 | ACE_Message_Block mb_in(to_mb(encoded_rtps_submessage.get_buffer()), |
| 2101 | encoded_rtps_submessage.length()); |
| 2102 | mb_in.wr_ptr(encoded_rtps_submessage.length()); |
| 2103 | Serializer de_ser(&mb_in, common_encoding); |
| 2104 | ACE_CDR::Octet type, flags; |
| 2105 | // SEC_PREFIX |
| 2106 | de_ser >> ACE_InputCDR::to_octet(type); |
| 2107 | de_ser >> ACE_InputCDR::to_octet(flags); |
| 2108 | de_ser.swap_bytes((flags & RTPS::FLAG_E) != ACE_CDR_BYTE_ORDER); |
| 2109 | ACE_CDR::UShort octetsToNext; |
| 2110 | de_ser >> octetsToNext; |
| 2111 | CryptoHeader ch = CryptoHeader(); |
| 2112 | de_ser.endianness(ENDIAN_BIG); |
| 2113 | de_ser >> ch; |
| 2114 | de_ser.skip(octetsToNext - CRYPTO_HEADER_LENGTH); |
| 2115 | if (!de_ser.good_bit()) { |
| 2116 | ACE_ERROR((LM_ERROR, |
| 2117 | "(%P|%t) ERROR: CryptoBuiltInImpl::decode_submessage: " |
| 2118 | "Failed to deserialize SEC_PREFIX\n")); |
| 2119 | return false; |
| 2120 | } |
| 2121 | |
| 2122 | // Next submessage, SEC_BODY if encrypted |
| 2123 | de_ser >> ACE_InputCDR::to_octet(type); |
| 2124 | de_ser >> ACE_InputCDR::to_octet(flags); |
| 2125 | de_ser.swap_bytes((flags & RTPS::FLAG_E) != ACE_CDR_BYTE_ORDER); |
| 2126 | de_ser >> octetsToNext; |
| 2127 | if (!de_ser.good_bit()) { |
| 2128 | ACE_ERROR((LM_ERROR, |
| 2129 | "(%P|%t) ERROR: CryptoBuiltInImpl::decode_submessage: " |
| 2130 | "Failed to deserialize next submessage\n")); |
| 2131 | return false; |
| 2132 | } |
| 2133 | |
| 2134 | Message_Block_Ptr mb_footer(mb_in.duplicate()); |
| 2135 | mb_footer->rd_ptr(octetsToNext); |
| 2136 | // SEC_POSTFIX |
| 2137 | Serializer post_ser(mb_footer.get(), common_encoding); |
| 2138 | post_ser >> ACE_InputCDR::to_octet(type); |
| 2139 | post_ser >> ACE_InputCDR::to_octet(flags); |
| 2140 | post_ser.swap_bytes((flags & RTPS::FLAG_E) != ACE_CDR_BYTE_ORDER); |
| 2141 | ACE_CDR::UShort postfixOctetsToNext; |
| 2142 | post_ser >> postfixOctetsToNext; |
| 2143 | CryptoFooter cf; |
| 2144 | de_ser.endianness(ENDIAN_BIG); |
| 2145 | post_ser >> cf; |
| 2146 | if (!post_ser.good_bit()) { |
| 2147 | ACE_ERROR((LM_ERROR, |
| 2148 | "(%P|%t) ERROR: CryptoBuiltInImpl::decode_submessage: " |
| 2149 | "Failed to deserialize SEC_POST\n")); |
| 2150 | return false; |
| 2151 | } |
nothing calls this directly
no test coverage detected