1 // SPDX-License-Identifier: BSD-2-Clause
2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3  *
4  * LibTomCrypt is a library that provides various cryptographic
5  * algorithms in a highly modular and flexible manner.
6  *
7  * The library is free for all purposes without any express
8  * guarantee it works.
9  */
10 #include "tomcrypt_private.h"
11 
12 /**
13   @file ed25519_import_pkcs8.c
14   Import an Ed25519 key in PKCS#8 format, Steffen Jaeckel
15 */
16 
17 #ifdef LTC_CURVE25519
18 
19 /**
20   Import an Ed25519 private key in PKCS#8 format
21   @param in        The DER-encoded PKCS#8-formatted private key
22   @param inlen     The length of the input data
23   @param passwd    The password to decrypt the private key
24   @param passwdlen Password's length (octets)
25   @param key       [out] Where to import the key to
26   @return CRYPT_OK if successful, on error all allocated memory is freed automatically
27 */
ed25519_import_pkcs8(const unsigned char * in,unsigned long inlen,const void * pwd,unsigned long pwdlen,curve25519_key * key)28 int ed25519_import_pkcs8(const unsigned char *in, unsigned long inlen,
29                                   const void *pwd, unsigned long pwdlen,
30                               curve25519_key *key)
31 {
32    return ec25519_import_pkcs8(in, inlen, pwd, pwdlen, PKA_ED25519, tweetnacl_crypto_sk_to_pk, key);
33 }
34 
35 #endif
36 
37 /* ref:         $Format:%D$ */
38 /* git commit:  $Format:%H$ */
39 /* commit time: $Format:%ai$ */
40