summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-08-30 13:33:10 +0100
committerMatt Caswell <matt@openssl.org>2019-09-09 13:52:26 +0100
commitdfcb5d29b525f5d2b6bd80602dca5efe5fca77bb (patch)
tree2cfb247b0ec70de547f7d376a090e57727d49771 /include
parent2b95e8efcf8b99892106070d9ac745a0a369f503 (diff)
Add the ability to perform signatures in a provider
This makes EVP_PKEY_sign and EVP_PKEY_sign_init provider aware. It also introduces the new type EVP_SIGNATURE to represent signature algorithms. This also automatically makes the EVP_Sign* APIs provider aware because they use EVP_Digest* (which is already provider aware) and EVP_PKEY_sign(_init) under the covers. At this stage there are no signature algorithms in any providers. That will come in the following commits. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9753)
Diffstat (limited to 'include')
-rw-r--r--include/openssl/core_numbers.h20
-rw-r--r--include/openssl/evp.h7
-rw-r--r--include/openssl/ossl_typ.h2
3 files changed, 28 insertions, 1 deletions
diff --git a/include/openssl/core_numbers.h b/include/openssl/core_numbers.h
index 521cd8c800..61ec1537b6 100644
--- a/include/openssl/core_numbers.h
+++ b/include/openssl/core_numbers.h
@@ -156,8 +156,9 @@ OSSL_CORE_MAKE_FUNC(const OSSL_ITEM *,provider_get_reason_strings,
# define OSSL_OP_KDF 4
# define OSSL_OP_KEYMGMT 10
# define OSSL_OP_KEYEXCH 11
+# define OSSL_OP_SIGNATURE 12
/* Highest known operation number */
-# define OSSL_OP__HIGHEST 11
+# define OSSL_OP__HIGHEST 12
/* Digests */
@@ -400,6 +401,23 @@ OSSL_CORE_MAKE_FUNC(void *, OP_keyexch_dupctx, (void *ctx))
OSSL_CORE_MAKE_FUNC(int, OP_keyexch_set_params, (void *ctx,
const OSSL_PARAM params[]))
+/* Signature */
+
+# define OSSL_FUNC_SIGNATURE_NEWCTX 1
+# define OSSL_FUNC_SIGNATURE_SIGN_INIT 2
+# define OSSL_FUNC_SIGNATURE_SIGN 3
+# define OSSL_FUNC_SIGNATURE_FREECTX 4
+# define OSSL_FUNC_SIGNATURE_DUPCTX 5
+
+OSSL_CORE_MAKE_FUNC(void *, OP_signature_newctx, (void *provctx))
+OSSL_CORE_MAKE_FUNC(int, OP_signature_sign_init, (void *ctx, void *provkey))
+OSSL_CORE_MAKE_FUNC(int, OP_signature_sign, (void *ctx, unsigned char *sig,
+ size_t *siglen, size_t sigsize,
+ const unsigned char *tbs,
+ size_t tbslen))
+OSSL_CORE_MAKE_FUNC(void, OP_signature_freectx, (void *ctx))
+OSSL_CORE_MAKE_FUNC(void *, OP_signature_dupctx, (void *ctx))
+
# ifdef __cplusplus
}
# endif
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index d1bd0b69d0..b09547a8b0 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -1470,6 +1470,13 @@ EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);
void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
+void EVP_SIGNATURE_free(EVP_SIGNATURE *signature);
+int EVP_SIGNATURE_up_ref(EVP_SIGNATURE *signature);
+OSSL_PROVIDER *EVP_SIGNATURE_provider(const EVP_SIGNATURE *signature);
+EVP_SIGNATURE *EVP_SIGNATURE_fetch(OPENSSL_CTX *ctx, const char *algorithm,
+ const char *properties);
+
+int EVP_PKEY_sign_init_ex(EVP_PKEY_CTX *ctx, EVP_SIGNATURE *signature);
int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
unsigned char *sig, size_t *siglen,
diff --git a/include/openssl/ossl_typ.h b/include/openssl/ossl_typ.h
index 7eec053bee..530de2d20c 100644
--- a/include/openssl/ossl_typ.h
+++ b/include/openssl/ossl_typ.h
@@ -108,6 +108,8 @@ typedef struct evp_kdf_ctx_st EVP_KDF_CTX;
typedef struct evp_keyexch_st EVP_KEYEXCH;
+typedef struct evp_signature_st EVP_SIGNATURE;
+
typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX;
typedef struct hmac_ctx_st HMAC_CTX;