1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4 
5 /**
6   @file x25519_import_pkcs8.c
7   Import a X25519 key in PKCS#8 format, Steffen Jaeckel
8 */
9 
10 #ifdef LTC_CURVE25519
11 
12 /**
13   Import a X25519 private key in PKCS#8 format
14   @param in        The DER-encoded PKCS#8-formatted private key
15   @param inlen     The length of the input data
16   @param passwd    The password to decrypt the private key
17   @param passwdlen Password's length (octets)
18   @param key       [out] Where to import the key to
19   @return CRYPT_OK if successful, on error all allocated memory is freed automatically
20 */
x25519_import_pkcs8(const unsigned char * in,unsigned long inlen,const void * pwd,unsigned long pwdlen,curve25519_key * key)21 int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen,
22                        const void *pwd, unsigned long pwdlen,
23                        curve25519_key *key)
24 {
25    return ec25519_import_pkcs8(in, inlen, pwd, pwdlen, LTC_OID_X25519, tweetnacl_crypto_scalarmult_base, key);
26 }
27 
28 #endif
29