9 #include "cbc_aes128-testdata.c"
12 dump(unsigned char *buf, size_t len) {
15 printf("%02x ", buf[i++]);
24 int main(int argc, char **argv) {
27 for (n = 0; n < sizeof(data)/sizeof(struct test_vector); ++n) {
28 dtls_cipher_context_t *cipher;
30 cipher = dtls_new_cipher(&ciphers[AES128],
35 fprintf(stderr, "cannot set key\n");
39 dtls_init_cipher(cipher, data[n].nonce, sizeof(data[n].nonce));
42 len = dtls_encrypt(cipher, data[n].msg, data[n].lm);
44 len = dtls_decrypt(cipher, data[n].msg, data[n].lm);
46 printf("Packet Vector #%d ", n+1);
47 if (len != data[n].r_lm
48 || memcmp(data[n].msg, data[n].result, len))
53 printf("result is (total length = %d):\n\t", (int)len);
54 dump(data[n].msg, len);