aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-02-01 15:34:13 +0000
committerDr. Stephen Henson <steve@openssl.org>2016-02-05 00:33:33 +0000
commitcf2413955cafcfe98d8292f996a87ef55b777caa (patch)
tree81d4e423646462cbbad98563d0c77c92663a54a2 /include
parent26c255fcf875d0272349c1221780dcd7e67b5d61 (diff)
downloadopenssl-cf2413955cafcfe98d8292f996a87ef55b777caa.zip
openssl-cf2413955cafcfe98d8292f996a87ef55b777caa.tar.gz
openssl-cf2413955cafcfe98d8292f996a87ef55b777caa.tar.bz2
Add EC_KEY_oct2priv and EC_KEY_priv2oct
New functions EC_KEY_oct2priv and EC_KEY_priv2oct. These are private key equivalents of EC_POINT_oct2point and EC_POINT_point2oct which convert between the private key octet format and EC_KEY. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Diffstat (limited to 'include')
-rw-r--r--include/openssl/ec.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/openssl/ec.h b/include/openssl/ec.h
index 75be82a..967edf3 100644
--- a/include/openssl/ec.h
+++ b/include/openssl/ec.h
@@ -934,6 +934,26 @@ size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form,
int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len,
BN_CTX *ctx);
+/** Decodes an EC_KEY private key from an octet string
+ * \param key key to decode
+ * \param buf memory buffer with the encoded private key
+ * \param len length of the encoded key
+ * \return 1 on success and 0 if an error occurred
+ */
+
+int EC_KEY_oct2priv(EC_KEY *key, unsigned char *buf, size_t len);
+
+/** Encodes a EC_KEY private key to an octet string
+ * \param key key to encode
+ * \param buf memory buffer for the result. If NULL the function returns
+ * required buffer size.
+ * \param len length of the memory buffer
+ * \return the length of the encoded octet string or 0 if an error occurred
+ */
+
+size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len);
+
+
/********************************************************************/
/* de- and encoding functions for SEC1 ECPrivateKey */
/********************************************************************/