=head1 NAME
EVP_MAC, EVP_MAC_fetch, EVP_MAC_up_ref, EVP_MAC_free,
-EVP_MAC_is_a, EVP_MAC_number, EVP_MAC_names_do_all,
+EVP_MAC_is_a, EVP_MAC_number, EVP_MAC_name, EVP_MAC_names_do_all,
EVP_MAC_provider, EVP_MAC_get_params, EVP_MAC_gettable_params,
EVP_MAC_CTX, EVP_MAC_CTX_new, EVP_MAC_CTX_free, EVP_MAC_CTX_dup,
EVP_MAC_CTX_mac, EVP_MAC_CTX_get_params, EVP_MAC_CTX_set_params,
-EVP_MAC_size, EVP_MAC_init, EVP_MAC_update, EVP_MAC_final,
+EVP_MAC_CTX_get_mac_size, EVP_MAC_init, EVP_MAC_update, EVP_MAC_final,
EVP_MAC_gettable_ctx_params, EVP_MAC_settable_ctx_params,
EVP_MAC_do_all_provided - EVP MAC routines
typedef struct evp_mac_st EVP_MAC;
typedef struct evp_mac_ctx_st EVP_MAC_CTX;
- EVP_MAC *EVP_MAC_fetch(OPENSSL_CTX *libctx, const char *algorithm,
+ EVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
const char *properties);
int EVP_MAC_up_ref(EVP_MAC *mac);
void EVP_MAC_free(EVP_MAC *mac);
int EVP_MAC_is_a(const EVP_MAC *mac, const char *name);
int EVP_MAC_number(const EVP_MAC *mac);
+ const char *EVP_MAC_name(const EVP_MAC *mac);
void EVP_MAC_names_do_all(const EVP_MAC *mac,
void (*fn)(const char *name, void *data),
void *data);
int EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]);
int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]);
- size_t EVP_MAC_size(EVP_MAC_CTX *ctx);
+ size_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx);
int EVP_MAC_init(EVP_MAC_CTX *ctx);
int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen);
int EVP_MAC_final(EVP_MAC_CTX *ctx,
const OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac);
const OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac);
- void EVP_MAC_do_all_provided(OPENSSL_CTX *libctx,
+ void EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_MAC *mac, void *arg),
void *arg);
=head2 Information functions
-EVP_MAC_size() returns the MAC output size for the given context.
+EVP_MAC_CTX_get_mac_size() returns the MAC output size for the given context.
EVP_MAC_is_a() checks if the given I<mac> is an implementation of an
algorithm that's identifiable with I<name>.
EVP_MAC_number() returns the internal dynamic number assigned to
I<mac>.
+EVP_MAC_name() return the name of the given MAC. For fetched MACs
+with multiple names, only one of them is returned; it's
+recommended to use EVP_MAC_names_do_all() instead.
+
EVP_MAC_names_do_all() traverses all names for I<mac>, and calls
I<fn> with each name and I<data>.
EVP_MAC_is_a() returns 1 if the given method can be identified with
the given name, otherwise 0.
+EVP_MAC_name() returns a name of the MAC, or NULL on error.
+
EVP_MAC_provider() returns a pointer to the provider for the MAC, or
NULL on error.
EVP_MAC_init(), EVP_MAC_update(), and EVP_MAC_final() return 1 on success, 0
on error.
-EVP_MAC_size() returns the expected output size, or 0 if it isn't
-set.
+EVP_MAC_CTX_get_mac_size() returns the expected output size, or 0 if it isn't set.
If it isn't set, a call to EVP_MAC_init() should get it set.
EVP_MAC_do_all_provided() returns nothing at all.
EVP_MAC_CTX *ctx = NULL;
unsigned char buf[4096];
- ssize_t read_l;
+ size_t read_l;
size_t final_l;
size_t i;
if (cipher != NULL)
params[params_n++] =
- OSSL_PARAM_construct_utf8_string("cipher", cipher, 0;
+ OSSL_PARAM_construct_utf8_string("cipher", (char*)cipher, 0);
if (digest != NULL)
params[params_n++] =
- OSSL_PARAM_construct_utf8_string("digest", digest, 0);
+ OSSL_PARAM_construct_utf8_string("digest", (char*)digest, 0);
params[params_n++] =
- OSSL_PARAM_construct_octet_string("key", key, strlen(key));
+ OSSL_PARAM_construct_octet_string("key", (void*)key, strlen(key));
params[params_n] = OSSL_PARAM_construct_end();
if (mac == NULL
goto err;
}
- if (!EVP_MAC_final(ctx, buf, &final_l))
+ if (!EVP_MAC_final(ctx, buf, &final_l, sizeof(buf)))
goto err;
printf("Result: ");