[dpdk-dev] [PATCH v2 5/6] test/crypto: add DOCSIS security test cases

Coyle, David david.coyle at intel.com
Fri Jun 26 17:14:43 CEST 2020


Hi Pablo

> -----Original Message-----
> From: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
> Sent: Tuesday, June 23, 2020 7:04 PM
> 
> > +static int
> > +test_docsis_proto_uplink(int i, struct docsis_test_data *d_td) {
> > +	struct rte_security_op *sec_op;
> > +	struct rte_security_docsis_op *doc_op;
> > +	struct crypto_testsuite_params *ts_params = &testsuite_params;
> > +	struct crypto_unittest_params *ut_params = &unittest_params;
> > +	uint8_t *plaintext, *ciphertext;
> > +	uint8_t *iv_ptr;
> > +	int cipher_len = 0;
> > +	int crc_len = 0, crc_data_len;
> 
> Minor comment. These "int" should be "unsigned int", as they are not going
> to hold a negative value.
[DC] Kind of correct, but not fully.

There are some calculations further down which subtract cipher_offset, crc_offset
and RTE_ETHER_CRC_LEN from the overall buffer size, which could (if test cases aren't
setup correctly) make the results negative. These results get put into the cipher_len and
crc_len variables. If the result is negative, it just gets reset to 0. This was just handier than
having if/else checks below. I don't see any major issue with this.

The crc_data_len variable can only have positive values though, so I have changed that
to a uint32_t

Updates will be in v3 early next week

> 
> > +	int ret = TEST_SUCCESS;


More information about the dev mailing list