1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4 
5 /**
6   @file ed25519_export.c
7   Export an Ed25519 key to a binary packet, Steffen Jaeckel
8 */
9 
10 #ifdef LTC_CURVE25519
11 
12 /**
13    Export an Ed25519 key to a binary packet
14    @param out    [out] The destination for the key
15    @param outlen [in/out] The max size and resulting size of the Ed25519 key
16    @param type   Which type of key (PK_PRIVATE, PK_PUBLIC|PK_STD or PK_PUBLIC)
17    @param key    The key you wish to export
18    @return CRYPT_OK if successful
19 */
ed25519_export(unsigned char * out,unsigned long * outlen,int which,const curve25519_key * key)20 int ed25519_export(       unsigned char *out, unsigned long *outlen,
21                                     int  which,
22                    const curve25519_key *key)
23 {
24    LTC_ARGCHK(key != NULL);
25 
26    if (key->algo != LTC_OID_ED25519) return CRYPT_PK_INVALID_TYPE;
27 
28    return ec25519_export(out, outlen, which, key);
29 }
30 
31 #endif
32