Skip to content

Instantly share code, notes, and snippets.

@kazuho
Created September 11, 2025 07:56
Show Gist options
  • Save kazuho/dc6714d5bcd877318aa90e7a653cb1d0 to your computer and use it in GitHub Desktop.
Save kazuho/dc6714d5bcd877318aa90e7a653cb1d0 to your computer and use it in GitHub Desktop.
#include <stdint.h>
#include <stdio.h>
#include <openssl/engine.h>
#include <openssl/provider.h>
#include "picotls.h"
#include "picotls/openssl.h"
int main(int argc, char **argv)
{
OSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, "legacy");
OSSL_PROVIDER *dflt = OSSL_PROVIDER_load(NULL, "default");
ptls_cipher_context_t *ctx = ptls_cipher_new(
#if 0
&ptls_openssl_aes128ecb,
#elif 1
&ptls_openssl_quiclb,
#else
&ptls_openssl_bfecb,
#endif
1, "0123456789abcdef");
uint8_t bytes[16] = {};
for (size_t i = 0; i < 100000000; ++i)
ptls_cipher_encrypt(ctx, bytes, bytes, 7);
printf("%02x\n", (unsigned)bytes[0]);
return 0;
}
@kazuho
Copy link
Author

kazuho commented Sep 11, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment