Created
May 7, 2020 04:56
-
-
Save kazuho/59c0a9c49654dd9aed96e136e7e2b066 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include "picotls/fusion.h" | |
int main(int argc, char **argv) | |
{ | |
static const uint8_t key[16] = {}, iv[12] = {}, aad[13] = {}; | |
ptls_fusion_aesgcm_context_t ctx; | |
size_t textlen = 16384; | |
if (sscanf(argv[1], "%zu", &textlen) != 1) { | |
fprintf(stderr, "failed to obtain text length from argument\n"); | |
return 1; | |
} | |
uint8_t *text = malloc(textlen + 16); | |
memset(text, 0, textlen + 16); | |
ptls_fusion_aesgcm_init(&ctx, key); | |
for (int i = 0; i < 1000000; ++i) | |
ptls_fusion_aesgcm_encrypt(&ctx, iv, aad, sizeof(aad), text, text, textlen); | |
for (int i = 0; i < 16; ++i) | |
printf("%02x", text[textlen + i]); | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment