+/**
+ * Sets (or resets) the master key and master salt for a SRTP session
+ * from hexadecimal strings. See also srtp_setkey().
+ *
+ * @return 0 on success, in case of error:
+ * EINVAL invalid or unsupported key/salt sizes combination
+ */
+int
+srtp_setkeystring (srtp_session_t *s, const char *key, const char *salt)
+{
+ uint8_t bkey[16]; /* TODO/NOTE: hard-coded for AES */
+ uint8_t bsalt[14]; /* TODO/NOTE: hard-coded for the PRF-AES-CM */
+ ssize_t bkeylen = hexstring (key, bkey, sizeof (bkey));
+ ssize_t bsaltlen = hexstring (salt, bsalt, sizeof (bsalt));
+
+ if ((bkeylen == -1) || (bsaltlen == -1))
+ return EINVAL;
+ return srtp_setkey (s, bkey, bkeylen, bsalt, bsaltlen) ? EINVAL : 0;
+}
+
+/**
+ * Sets Roll-over-Counter Carry (RCC) rate for the SRTP session. If not
+ * specified (through this function), the default rate of ONE is assumed
+ * (i.e. every RTP packets will carry the RoC). RCC rate is ignored if none
+ * of the RCC mode has been selected.
+ *
+ * The RCC mode is selected through one of these flags for srtp_create():
+ * SRTP_RCC_MODE1: integrity protection only for RoC carrying packets
+ * SRTP_RCC_MODE2: integrity protection for all packets
+ * SRTP_RCC_MODE3: no integrity protection
+ *
+ * RCC mode 3 is insecure. Compared to plain RTP, it provides confidentiality
+ * (through encryption) but is much more prone to DoS. It can only be used if
+ * anti-spoofing protection is provided by lower network layers (e.g. IPsec,
+ * or trusted routers and proper source address filtering).
+ *
+ * If RCC rate is 1, RCC mode 1 and 2 are functionally identical.
+ *
+ * @param rate RoC Carry rate (MUST NOT be zero)
+ */
+void srtp_setrcc_rate (srtp_session_t *s, uint16_t rate)
+{
+ assert (rate != 0);
+ s->rtp_rcc = rate;