xref: /freebsd/crypto/libecc/src/utils/print_keys.c (revision f0865ec9906d5a18fa2a3b61381f22ce16e606ad)
1*f0865ec9SKyle Evans /*
2*f0865ec9SKyle Evans  *  Copyright (C) 2017 - This file is part of libecc project
3*f0865ec9SKyle Evans  *
4*f0865ec9SKyle Evans  *  Authors:
5*f0865ec9SKyle Evans  *      Ryad BENADJILA <ryadbenadjila@gmail.com>
6*f0865ec9SKyle Evans  *      Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr>
7*f0865ec9SKyle Evans  *      Jean-Pierre FLORI <jean-pierre.flori@ssi.gouv.fr>
8*f0865ec9SKyle Evans  *
9*f0865ec9SKyle Evans  *  Contributors:
10*f0865ec9SKyle Evans  *      Nicolas VIVET <nicolas.vivet@ssi.gouv.fr>
11*f0865ec9SKyle Evans  *      Karim KHALFALLAH <karim.khalfallah@ssi.gouv.fr>
12*f0865ec9SKyle Evans  *
13*f0865ec9SKyle Evans  *  This software is licensed under a dual BSD and GPL v2 license.
14*f0865ec9SKyle Evans  *  See LICENSE file at the root folder of the project.
15*f0865ec9SKyle Evans  */
16*f0865ec9SKyle Evans #include <libecc/utils/print_keys.h>
17*f0865ec9SKyle Evans 
priv_key_print(const char * msg,const ec_priv_key * priv)18*f0865ec9SKyle Evans void priv_key_print(const char *msg, const ec_priv_key *priv)
19*f0865ec9SKyle Evans {
20*f0865ec9SKyle Evans 	int ret;
21*f0865ec9SKyle Evans 
22*f0865ec9SKyle Evans 	MUST_HAVE(msg != NULL, ret, err);
23*f0865ec9SKyle Evans 	ret = priv_key_check_initialized(priv); EG(ret, err);
24*f0865ec9SKyle Evans 
25*f0865ec9SKyle Evans 	nn_print(msg, &(priv->x));
26*f0865ec9SKyle Evans 
27*f0865ec9SKyle Evans err:
28*f0865ec9SKyle Evans 	return;
29*f0865ec9SKyle Evans }
30*f0865ec9SKyle Evans 
pub_key_print(const char * msg,const ec_pub_key * pub)31*f0865ec9SKyle Evans void pub_key_print(const char *msg, const ec_pub_key *pub)
32*f0865ec9SKyle Evans {
33*f0865ec9SKyle Evans 	int ret;
34*f0865ec9SKyle Evans 
35*f0865ec9SKyle Evans 	MUST_HAVE(msg != NULL, ret, err);
36*f0865ec9SKyle Evans 	ret = pub_key_check_initialized(pub); EG(ret, err);
37*f0865ec9SKyle Evans 
38*f0865ec9SKyle Evans 	ec_point_print(msg, &(pub->y));
39*f0865ec9SKyle Evans 
40*f0865ec9SKyle Evans err:
41*f0865ec9SKyle Evans 	return;
42*f0865ec9SKyle Evans }
43