X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fed25519%2Fecdsagen.c;h=bc14fd297abcaaf04c903562dde315059bdc07e6;hb=6f4b3a814f79952dd38a18b82c89674a43e94e0a;hp=5120f28776c7f64a0e68d50feb59e8fd5ccee524;hpb=3a316823b971396a428f020f401b9fe41252d98d;p=tinc diff --git a/src/ed25519/ecdsagen.c b/src/ed25519/ecdsagen.c index 5120f287..bc14fd29 100644 --- a/src/ed25519/ecdsagen.c +++ b/src/ed25519/ecdsagen.c @@ -27,10 +27,10 @@ typedef struct { uint8_t public[32]; } ecdsa_t; -#include "../crypto.h" #include "../ecdsagen.h" #include "../utils.h" #include "../xalloc.h" +#include "../random.h" // Generate ECDSA key @@ -46,13 +46,15 @@ ecdsa_t *ecdsa_generate(void) { // Write PEM ECDSA keys -static bool write_pem(FILE *fp, const char *type, void *buf, size_t size) { +static bool write_pem(FILE *fp, const char *type, void *vbuf, size_t size) { fprintf(fp, "-----BEGIN %s-----\n", type); + char *buf = vbuf; char base64[65]; + while(size) { size_t todo = size > 48 ? 48 : size; - b64encode(buf, base64, todo); + b64encode_tinc(buf, base64, todo); fprintf(fp, "%s\n", base64); buf += todo; size -= todo;