Revert commit 33af72df in order to not depend on test code

Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
Michael Schuster
2024-07-21 00:44:33 +02:00
committed by Minos Galanakis
parent 82cb06913a
commit c1cd26b20f
6 changed files with 46 additions and 26 deletions

View File

@@ -35,8 +35,6 @@
#include "mbedtls/cipher.h"
#include <test/helpers.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -80,6 +78,16 @@ const unsigned char msg2_part2[] = { 0x15, 0x16, 0x17 };
* 32-byte is enough to all the key size supported by this program. */
const unsigned char key_bytes[32] = { 0x2a };
/* Print the contents of a buffer in hex */
void print_buf(const char *title, unsigned char *buf, size_t len)
{
printf("%s:", title);
for (size_t i = 0; i < len; i++) {
printf(" %02x", buf[i]);
}
printf("\n");
}
/* Run an Mbed TLS function and bail out if it fails.
* A string description of the error code can be recovered with:
* programs/util/strerror <value> */
@@ -190,7 +198,7 @@ static int aead_encrypt(mbedtls_cipher_context_t *ctx, size_t tag_len,
p += tag_len;
olen = p - out;
mbedtls_test_print_buf("out", out, olen);
print_buf("out", out, olen);
exit:
return ret;