X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=test%2Fbad_dtls_test.c;h=66b5e1d2eda8f21c8bd5ae7524eabef5f3fd2472;hp=932cb0eb1daf48cd44e7491b53aaf8bb2350e00c;hb=0d345f0e10b14392925479fc61b6c9072a9605a3;hpb=b99fe5f4927b305bae88daac2484c284fe749329 diff --git a/test/bad_dtls_test.c b/test/bad_dtls_test.c index 932cb0eb1d..66b5e1d2ed 100644 --- a/test/bad_dtls_test.c +++ b/test/bad_dtls_test.c @@ -1,7 +1,7 @@ /* * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved. * - * Licensed under the OpenSSL license (the "License"). You may not use + * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html @@ -19,7 +19,7 @@ * Note that unlike other SSL tests, we don't test against our own SSL * server method. Firstly because we don't have one; we *only* support * DTLS1_BAD_VER as a client. And secondly because even if that were - * fixed up it's the wrong thing to test against — because if changes + * fixed up it's the wrong thing to test against - because if changes * are made in generic DTLS code which don't take DTLS1_BAD_VER into * account, there's plenty of scope for making those changes such that * they break *both* the client and the server in the same way. @@ -37,10 +37,8 @@ #include #include #include - -#include "../ssl/packet_locl.h" -#include - +#include "internal/packet.h" +#include "internal/nelem.h" #include "testutil.h" /* For DTLS1_BAD_VER packets the MAC doesn't include the handshake header */ @@ -120,7 +118,7 @@ static int validate_client_hello(BIO *wbio) long len; unsigned char *data; int cookie_found = 0; - unsigned int u; + unsigned int u = 0; len = BIO_get_mem_data(wbio, (char **)&data); if (!PACKET_buf_init(&pkt, data, len)) @@ -308,8 +306,8 @@ static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr, HMAC_Update(ctx, seq, 6); HMAC_Update(ctx, &type, 1); HMAC_Update(ctx, ver, 2); /* Version */ - lenbytes[0] = len >> 8; - lenbytes[1] = len & 0xff; + lenbytes[0] = (unsigned char)(len >> 8); + lenbytes[1] = (unsigned char)(len); HMAC_Update(ctx, lenbytes, 2); /* Length */ HMAC_Update(ctx, enc, len); /* Finally the data itself */ HMAC_Final(ctx, enc + len, NULL); @@ -333,8 +331,8 @@ static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr, BIO_write(rbio, ver, 2); BIO_write(rbio, epoch, 2); BIO_write(rbio, seq, 6); - lenbytes[0] = (len + sizeof(iv)) >> 8; - lenbytes[1] = (len + sizeof(iv)) & 0xff; + lenbytes[0] = (unsigned char)((len + sizeof(iv)) >> 8); + lenbytes[1] = (unsigned char)(len + sizeof(iv)); BIO_write(rbio, lenbytes, 2); BIO_write(rbio, iv, sizeof(iv));