git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prepare for post-2.2.0 (2.2.90).
[sliver-openvswitch.git]
/
tests
/
test-aes128.c
diff --git
a/tests/test-aes128.c
b/tests/test-aes128.c
index
8a6c28c
..
86f5521
100644
(file)
--- a/
tests/test-aes128.c
+++ b/
tests/test-aes128.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2009
Nicira Networks
.
+ * Copyright (c) 2009
, 2010, 2013, 2014 Nicira, Inc
.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-18,6
+18,7
@@
#include <ctype.h>
#include "aes128.h"
#include "util.h"
#include <ctype.h>
#include "aes128.h"
#include "util.h"
+#include "ovstest.h"
static void
hex_to_uint8(const char *input, uint8_t *output, size_t n)
static void
hex_to_uint8(const char *input, uint8_t *output, size_t n)
@@
-28,22
+29,21
@@
hex_to_uint8(const char *input, uint8_t *output, size_t n)
goto error;
}
for (i = 0; i < n; i++) {
goto error;
}
for (i = 0; i < n; i++) {
- unsigned char hi = input[i * 2];
- unsigned char lo = input[i * 2 + 1];
+ bool ok;
- if (!isxdigit(hi) || !isxdigit(lo)) {
+ output[i] = hexits_value(&input[i * 2], 2, &ok);
+ if (!ok) {
goto error;
}
goto error;
}
- output[i] = (hexit_value(hi) << 4) + hexit_value(lo);
}
return;
error:
}
return;
error:
- ovs_fatal(0, "\"%s\" is not exactly %
zu
hex digits", input, n * 2);
+ ovs_fatal(0, "\"%s\" is not exactly %
"PRIuSIZE"
hex digits", input, n * 2);
}
}
-int
-main(int argc, char *argv[])
+static void
+
test_aes128_
main(int argc, char *argv[])
{
struct aes128 aes;
uint8_t plaintext[16];
{
struct aes128 aes;
uint8_t plaintext[16];
@@
-65,6
+65,6
@@
main(int argc, char *argv[])
printf("%02x", ciphertext[i]);
}
putchar('\n');
printf("%02x", ciphertext[i]);
}
putchar('\n');
-
- return 0;
}
}
+
+OVSTEST_REGISTER("test-aes128", test_aes128_main);