import mbedtls ecc point (de)compression extension and use

This commit is contained in:
Grayson Martin 2023-07-06 18:03:58 -05:00
commit 44f2e253d8
No known key found for this signature in database
GPG key ID: 4914C62F2696A273
4 changed files with 237 additions and 5 deletions

View file

@ -0,0 +1,32 @@
/*
* Not original to the mbedtls library. Taken from
* https://github.com/mwarning/mbedtls_ecp_compression
* to solve mbedtls' lack of support for elliptic point
* compression and decompression
*
* Released under CC0 1.0 Universal License
*/
/*
* This is all about mbedtls_ecp_decompress() and mbedtls_ecp_compress()
*
* Perform X25519 / Curve25519 point compression and decompression for mbedtls.
* As of mbedtls 2.5.1, mbedtls does not support decompression yet.
*
*/
#include <string.h>
#include "mbedtls/ecp.h"
int mbedtls_ecp_decompress(
const mbedtls_ecp_group *grp,
const unsigned char *input, size_t ilen,
unsigned char *output, size_t *olen, size_t osize
);
int mbedtls_ecp_compress(
const mbedtls_ecp_group *grp,
const unsigned char *input, size_t ilen,
unsigned char *output, size_t *olen, size_t osize
);