Add custom sig_info_set for ED25519
authorDr. Stephen Henson <steve@openssl.org>
Tue, 25 Apr 2017 19:34:58 +0000 (20:34 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 30 May 2017 19:38:20 +0000 (20:38 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)

crypto/ec/ecx_meth.c

index b9046b3..715fe06 100644 (file)
@@ -371,6 +371,14 @@ static int ecd_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
     return 3;
 }
 
+static int ecd_sig_info_set(X509_SIG_INFO *siginf, const X509_ALGOR *alg,
+                            const ASN1_STRING *sig)
+{
+    X509_SIG_INFO_set(siginf, NID_undef, NID_ED25519, X25519_SECURITY_BITS,
+                      X509_SIG_INFO_TLS);
+    return 1;
+}
+
 const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = {
     NID_ED25519,
     NID_ED25519,
@@ -400,7 +408,8 @@ const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = {
     NULL,
     NULL,
     ecd_item_verify,
-    ecd_item_sign
+    ecd_item_sign,
+    ecd_sig_info_set
 };
 
 static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)