+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifdef RTE_EXEC_ENV_BSDAPP
+ #define _WITH_GETLINE
+#endif
#include <stdio.h>
#include <rte_malloc.h>
uint8_t *data = NULL;
char *token, *key_token;
+ if (entry == NULL) {
+ printf("Expected entry value\n");
+ return -1;
+ }
+
/* get key */
token = strtok(entry, CPERF_ENTRY_DELIMITER);
key_token = token;
-
/* get values for key */
token = strtok(NULL, CPERF_ENTRY_DELIMITER);
- if (token == NULL) {
- printf("Expected 'key = values' but was '%.40s'..\n",
- key_token);
+
+ if (key_token == NULL || token == NULL) {
+ printf("Expected 'key = values' but was '%.40s'..\n", entry);
return -1;
}
if (tc_found)
vector->plaintext.length = data_length;
else {
- if (opts->buffer_sz > data_length) {
+ if (opts->max_buffer_size > data_length) {
printf("Global plaintext shorter than "
"buffer_sz\n");
return -1;
}
- vector->plaintext.length = opts->buffer_sz;
+ vector->plaintext.length = opts->max_buffer_size;
}
} else if (strstr(key_token, "cipher_key")) {
} else if (strstr(key_token, "iv")) {
rte_free(vector->iv.data);
vector->iv.data = data;
- vector->iv.phys_addr = rte_malloc_virt2phy(vector->iv.data);
if (tc_found)
vector->iv.length = data_length;
else {
if (tc_found)
vector->ciphertext.length = data_length;
else {
- if (opts->buffer_sz > data_length) {
+ if (opts->max_buffer_size > data_length) {
printf("Global ciphertext shorter than "
"buffer_sz\n");
return -1;
}
- vector->ciphertext.length = opts->buffer_sz;
+ vector->ciphertext.length = opts->max_buffer_size;
}
} else if (strstr(key_token, "aad")) {
/* other values not included in the file */
test_vector->data.cipher_offset = 0;
- test_vector->data.cipher_length = opts->buffer_sz;
+ test_vector->data.cipher_length = opts->max_buffer_size;
test_vector->data.auth_offset = 0;
- test_vector->data.auth_length = opts->buffer_sz;
+ test_vector->data.auth_length = opts->max_buffer_size;
return test_vector;
}