| 1046 | } |
| 1047 | |
| 1048 | int JLSRTP::setAESPseudoRandomFunctionKey(ActiveCrypto crypto_attrib /*= ACTIVE_CRYPTO*/) |
| 1049 | { |
| 1050 | ActiveCrypto active_crypto = INVALID_CRYPTO; |
| 1051 | int rc = 0; |
| 1052 | int retVal = 0; |
| 1053 | |
| 1054 | if (_pseudorandomstate.cipher != nullptr) |
| 1055 | { |
| 1056 | if (crypto_attrib == ACTIVE_CRYPTO) |
| 1057 | { |
| 1058 | active_crypto = _active_crypto; |
| 1059 | } |
| 1060 | else |
| 1061 | { |
| 1062 | active_crypto = crypto_attrib; |
| 1063 | } |
| 1064 | |
| 1065 | switch (active_crypto) |
| 1066 | { |
| 1067 | case PRIMARY_CRYPTO: |
| 1068 | { |
| 1069 | rc = EVP_EncryptInit_ex(_pseudorandomstate.cipher, nullptr, nullptr, _primary_crypto.master_key.data(), nullptr); |
| 1070 | if (rc == 1) |
| 1071 | { |
| 1072 | retVal = 0; |
| 1073 | } |
| 1074 | else |
| 1075 | { |
| 1076 | retVal = -2; |
| 1077 | } |
| 1078 | } |
| 1079 | break; |
| 1080 | |
| 1081 | case SECONDARY_CRYPTO: |
| 1082 | { |
| 1083 | rc = EVP_EncryptInit_ex(_pseudorandomstate.cipher, nullptr, nullptr, _secondary_crypto.master_key.data(), nullptr); |
| 1084 | if (rc == 1) |
| 1085 | { |
| 1086 | retVal = 0; |
| 1087 | } |
| 1088 | else |
| 1089 | { |
| 1090 | retVal = -3; |
| 1091 | } |
| 1092 | } |
| 1093 | break; |
| 1094 | |
| 1095 | default: |
| 1096 | { |
| 1097 | retVal = -4; |
| 1098 | } |
| 1099 | break; |
| 1100 | } |
| 1101 | } |
| 1102 | else |
| 1103 | { |
| 1104 | retVal = -1; |
| 1105 | } |
nothing calls this directly
no outgoing calls
no test coverage detected