| 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 | int x25519_import_pkcs8_asn1(ltc_asn1_list *alg_id, ltc_asn1_list *priv_key, |
| 13 | curve25519_key *key) |
| 14 | { |
| 15 | return ec25519_import_pkcs8_asn1(alg_id, priv_key, LTC_OID_X25519, key); |
| 16 | } |
| 17 | /** |
| 18 | Import a X25519 private key in PKCS#8 format |
| 19 | @param in The packet to import from |
| 20 | @param inlen It's length (octets) |
| 21 | @param pw_ctx The password context when decrypting the private key |
| 22 | @param key [out] Destination for newly imported key |
| 23 | @return CRYPT_OK if successful, on error all allocated memory is freed automatically |
| 24 | */ |
| 25 | int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen, |
| 26 | const password_ctx *pw_ctx, |
| 27 | curve25519_key *key) |
| 28 | { |
| 29 | return ec25519_import_pkcs8(in, inlen, pw_ctx, LTC_OID_X25519, key); |
| 30 | } |
| 31 | |
| 32 | #endif |