summaryrefslogtreecommitdiffstats
path: root/ssl/d1_srtp.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-08-04 17:36:02 +0100
committerMatt Caswell <matt@openssl.org>2015-09-07 10:45:38 +0100
commit50932c4af2fdd1da01203e9fabe176f9c106882b (patch)
treeced91433db18898536f2282a590ca50f13101749 /ssl/d1_srtp.c
parent0e2d091103ed5846c72a5c9e8b10e25ead4bf152 (diff)
PACKETise ServerHello processing
Process ServerHello messages using the PACKET API Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'ssl/d1_srtp.c')
-rw-r--r--ssl/d1_srtp.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/ssl/d1_srtp.c b/ssl/d1_srtp.c
index 4384edabc6..87dbcc63f3 100644
--- a/ssl/d1_srtp.c
+++ b/ssl/d1_srtp.c
@@ -358,33 +358,27 @@ int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len,
return 0;
}
-int ssl_parse_serverhello_use_srtp_ext(SSL *s, unsigned char *d, int len,
- int *al)
+int ssl_parse_serverhello_use_srtp_ext(SSL *s, PACKET *pkt, int *al)
{
- unsigned id;
+ unsigned int id, ct, mki;
int i;
- int ct;
STACK_OF(SRTP_PROTECTION_PROFILE) *clnt;
SRTP_PROTECTION_PROFILE *prof;
- if (len != 5) {
- SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,
- SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
- *al = SSL_AD_DECODE_ERROR;
- return 1;
- }
-
- n2s(d, ct);
- if (ct != 2) {
+ if (!PACKET_get_net_2(pkt, &ct)
+ || ct != 2
+ || !PACKET_get_net_2(pkt, &id)
+ || !PACKET_get_1(pkt, &mki)
+ || PACKET_remaining(pkt) != 0) {
SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,
SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
*al = SSL_AD_DECODE_ERROR;
return 1;
}
- n2s(d, id);
- if (*d) { /* Must be no MKI, since we never offer one */
+ if (mki != 0) {
+ /* Must be no MKI, since we never offer one */
SSLerr(SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT,
SSL_R_BAD_SRTP_MKI_VALUE);
*al = SSL_AD_ILLEGAL_PARAMETER;