aboutsummaryrefslogtreecommitdiff
path: root/providers/implementations/encode_decode/encode_key2blob.c
diff options
context:
space:
mode:
Diffstat (limited to 'providers/implementations/encode_decode/encode_key2blob.c')
-rw-r--r--providers/implementations/encode_decode/encode_key2blob.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/providers/implementations/encode_decode/encode_key2blob.c b/providers/implementations/encode_decode/encode_key2blob.c
index 29e72faa63de..437bf022d62b 100644
--- a/providers/implementations/encode_decode/encode_key2blob.c
+++ b/providers/implementations/encode_decode/encode_key2blob.c
@@ -27,7 +27,7 @@
#include "endecoder_local.h"
static int write_blob(void *provctx, OSSL_CORE_BIO *cout,
- void *data, int len)
+ void *data, int len)
{
BIO *out = ossl_bio_new_from_core_bio(provctx, cout);
int ret;
@@ -86,7 +86,7 @@ static int key2blob_check_selection(int selection, int selection_mask)
}
static int key2blob_encode(void *vctx, const void *key, int selection,
- OSSL_CORE_BIO *cout)
+ OSSL_CORE_BIO *cout)
{
int pubkey_len = 0, ok = 0;
unsigned char *pubkey = NULL;
@@ -118,62 +118,62 @@ static int key2blob_encode(void *vctx, const void *key, int selection,
* EVP_PKEY_##selection_name are convenience macros that combine "typical"
* OSSL_KEYMGMT_SELECT_ macros for a certain type of EVP_PKEY content.
*/
-#define MAKE_BLOB_ENCODER(impl, type, selection_name) \
- static OSSL_FUNC_encoder_import_object_fn \
- impl##2blob_import_object; \
- static OSSL_FUNC_encoder_free_object_fn impl##2blob_free_object; \
- static OSSL_FUNC_encoder_does_selection_fn \
- impl##2blob_does_selection; \
- static OSSL_FUNC_encoder_encode_fn impl##2blob_encode; \
- \
- static void *impl##2blob_import_object(void *ctx, int selection, \
- const OSSL_PARAM params[]) \
- { \
- return ossl_prov_import_key(ossl_##impl##_keymgmt_functions, \
- ctx, selection, params); \
- } \
- static void impl##2blob_free_object(void *key) \
- { \
- ossl_prov_free_key(ossl_##impl##_keymgmt_functions, key); \
- } \
- static int impl##2blob_does_selection(void *ctx, int selection) \
- { \
- return key2blob_check_selection(selection, \
- EVP_PKEY_##selection_name); \
- } \
- static int impl##2blob_encode(void *vctx, OSSL_CORE_BIO *cout, \
- const void *key, \
- const OSSL_PARAM key_abstract[], \
- int selection, \
- OSSL_PASSPHRASE_CALLBACK *cb, \
- void *cbarg) \
- { \
- /* We don't deal with abstract objects */ \
- if (key_abstract != NULL) { \
- ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT); \
- return 0; \
- } \
- return key2blob_encode(vctx, key, selection, cout); \
- } \
- const OSSL_DISPATCH ossl_##impl##_to_blob_encoder_functions[] = { \
- { OSSL_FUNC_ENCODER_NEWCTX, \
- (void (*)(void))key2blob_newctx }, \
- { OSSL_FUNC_ENCODER_FREECTX, \
- (void (*)(void))key2blob_freectx }, \
- { OSSL_FUNC_ENCODER_DOES_SELECTION, \
- (void (*)(void))impl##2blob_does_selection }, \
- { OSSL_FUNC_ENCODER_IMPORT_OBJECT, \
- (void (*)(void))impl##2blob_import_object }, \
- { OSSL_FUNC_ENCODER_FREE_OBJECT, \
- (void (*)(void))impl##2blob_free_object }, \
- { OSSL_FUNC_ENCODER_ENCODE, \
- (void (*)(void))impl##2blob_encode }, \
- OSSL_DISPATCH_END \
+#define MAKE_BLOB_ENCODER(impl, type, selection_name) \
+ static OSSL_FUNC_encoder_import_object_fn \
+ impl##2blob_import_object; \
+ static OSSL_FUNC_encoder_free_object_fn impl##2blob_free_object; \
+ static OSSL_FUNC_encoder_does_selection_fn \
+ impl##2blob_does_selection; \
+ static OSSL_FUNC_encoder_encode_fn impl##2blob_encode; \
+ \
+ static void *impl##2blob_import_object(void *ctx, int selection, \
+ const OSSL_PARAM params[]) \
+ { \
+ return ossl_prov_import_key(ossl_##impl##_keymgmt_functions, \
+ ctx, selection, params); \
+ } \
+ static void impl##2blob_free_object(void *key) \
+ { \
+ ossl_prov_free_key(ossl_##impl##_keymgmt_functions, key); \
+ } \
+ static int impl##2blob_does_selection(void *ctx, int selection) \
+ { \
+ return key2blob_check_selection(selection, \
+ EVP_PKEY_##selection_name); \
+ } \
+ static int impl##2blob_encode(void *vctx, OSSL_CORE_BIO *cout, \
+ const void *key, \
+ const OSSL_PARAM key_abstract[], \
+ int selection, \
+ OSSL_PASSPHRASE_CALLBACK *cb, \
+ void *cbarg) \
+ { \
+ /* We don't deal with abstract objects */ \
+ if (key_abstract != NULL) { \
+ ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT); \
+ return 0; \
+ } \
+ return key2blob_encode(vctx, key, selection, cout); \
+ } \
+ const OSSL_DISPATCH ossl_##impl##_to_blob_encoder_functions[] = { \
+ { OSSL_FUNC_ENCODER_NEWCTX, \
+ (void (*)(void))key2blob_newctx }, \
+ { OSSL_FUNC_ENCODER_FREECTX, \
+ (void (*)(void))key2blob_freectx }, \
+ { OSSL_FUNC_ENCODER_DOES_SELECTION, \
+ (void (*)(void))impl##2blob_does_selection }, \
+ { OSSL_FUNC_ENCODER_IMPORT_OBJECT, \
+ (void (*)(void))impl##2blob_import_object }, \
+ { OSSL_FUNC_ENCODER_FREE_OBJECT, \
+ (void (*)(void))impl##2blob_free_object }, \
+ { OSSL_FUNC_ENCODER_ENCODE, \
+ (void (*)(void))impl##2blob_encode }, \
+ OSSL_DISPATCH_END \
}
#ifndef OPENSSL_NO_EC
MAKE_BLOB_ENCODER(ec, ec, PUBLIC_KEY);
-# ifndef OPENSSL_NO_SM2
+#ifndef OPENSSL_NO_SM2
MAKE_BLOB_ENCODER(sm2, ec, PUBLIC_KEY);
-# endif
+#endif
#endif