Check rdp identity in TLS handshake
Compare peer identity and "oic.sec.doxm.rdp"
before PPSK generation at the random pin otm
process
@@ -541,10 +541,13 @@ get_psk_cb(void *data, mbedtls_ssl_context *ssl, const unsigned char *identity,
OC_DBG("oc_tls: Set peer credential to SSL handle");
return 0;
} else {
- OC_DBG("oc_tls: deriving PPSK for PIN OTM");
oc_sec_doxm_t *doxm = oc_sec_get_doxm(peer->endpoint.device);
oc_sec_pstat_t *ps = oc_sec_get_pstat(peer->endpoint.device);
- if (ps->s == OC_DOS_RFOTM && doxm->oxmsel == OC_OXMTYPE_RDP) {
+ if (ps->s == OC_DOS_RFOTM
+ && doxm->oxmsel == OC_OXMTYPE_RDP
+ && identity_len == 16
+ && memcmp(identity, "oic.sec.doxm.rdp", 16)== 0) {
+ OC_DBG("oc_tls: deriving PPSK for PIN OTM");
memcpy(peer->uuid.id, identity, 16);
uint8_t key[16];
