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_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_CTX, EVP_MAC_new_ctx, EVP_MAC_free_ctx, EVP_MAC_dup_ctx,
+EVP_MAC_get_ctx_mac, EVP_MAC_get_ctx_params, EVP_MAC_set_ctx_params,
EVP_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
const OSSL_PROVIDER *EVP_MAC_provider(const EVP_MAC *mac);
int EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[]);
- EVP_MAC_CTX *EVP_MAC_CTX_new(EVP_MAC *mac);
- void EVP_MAC_CTX_free(EVP_MAC_CTX *ctx);
- EVP_MAC_CTX *EVP_MAC_CTX_dup(const EVP_MAC_CTX *src);
- EVP_MAC *EVP_MAC_CTX_mac(EVP_MAC_CTX *ctx);
- 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[]);
+ EVP_MAC_CTX *EVP_MAC_new_ctx(EVP_MAC *mac);
+ void EVP_MAC_free_ctx(EVP_MAC_CTX *ctx);
+ EVP_MAC_CTX *EVP_MAC_dup_ctx(const EVP_MAC_CTX *src);
+ EVP_MAC *EVP_MAC_get_ctx_mac(EVP_MAC_CTX *ctx);
+ int EVP_MAC_get_ctx_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]);
+ int EVP_MAC_set_ctx_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]);
size_t EVP_MAC_size(EVP_MAC_CTX *ctx);
int EVP_MAC_init(EVP_MAC_CTX *ctx);
a library context I<libctx> and a set of I<properties>.
See L<provider(7)/Fetching algorithms> for further information.
+See L<OSSL_PROVIDER-default(7)/Message Authentication Code (MAC)> for the list
+of algorithms supported by the default provider.
+
The returned value must eventually be freed with
L<EVP_MAC_free(3)>.
=head2 Context manipulation functions
-EVP_MAC_CTX_new() creates a new context for the MAC type I<mac>.
+EVP_MAC_new_ctx() creates a new context for the MAC type I<mac>.
The created context can then be used with most other functions
described here.
-EVP_MAC_CTX_free() frees the contents of the context, including an
+EVP_MAC_free_ctx() frees the contents of the context, including an
underlying context if there is one, as well as the context itself.
NULL is a valid parameter, for which this function is a no-op.
-EVP_MAC_CTX_dup() duplicates the I<src> context and returns a newly allocated
+EVP_MAC_dup_ctx() duplicates the I<src> context and returns a newly allocated
context.
-EVP_MAC_CTX_mac() returns the B<EVP_MAC> associated with the context
+EVP_MAC_get_ctx_mac() returns the B<EVP_MAC> associated with the context
I<ctx>.
=head2 Computing functions
Note that a parameter that is unknown in the underlying context is
simply ignored.
-EVP_MAC_CTX_get_params() retrieves chosen parameters, given the
+EVP_MAC_get_ctx_params() retrieves chosen parameters, given the
context I<ctx> and its underlying context.
The set of parameters given with I<params> determine exactly what
parameters should be retrieved.
Note that a parameter that is unknown in the underlying context is
simply ignored.
-EVP_MAC_CTX_set_params() passes chosen parameters to the underlying
+EVP_MAC_set_ctx_params() passes chosen parameters to the underlying
context, given a context I<ctx>.
The set of parameters given with I<params> determine exactly what
parameters are passed down.
EVP_MAC_gettable_params(), EVP_MAC_gettable_ctx_params() and
EVP_MAC_settable_ctx_params() get a constant B<OSSL_PARAM> array that
-decribes the retrievable and settable parameters, i.e. parameters that
-can be used with EVP_MAC_get_params(), EVP_MAC_CTX_get_params()
-and EVP_MAC_CTX_set_params(), respectively.
+describes the retrievable and settable parameters, i.e. parameters that
+can be used with EVP_MAC_get_params(), EVP_MAC_get_ctx_params()
+and EVP_MAC_set_ctx_params(), respectively.
See L<OSSL_PARAM(3)> for the use of B<OSSL_PARAM> as parameter descriptor.
=head2 Information functions
EVP_MAC_provider() returns a pointer to the provider for the MAC, or
NULL on error.
-EVP_MAC_CTX_new() and EVP_MAC_CTX_dup() return a pointer to a newly
+EVP_MAC_new_ctx() and EVP_MAC_dup_ctx() return a pointer to a newly
created EVP_MAC_CTX, or NULL if allocation failed.
-EVP_MAC_CTX_free() returns nothing at all.
+EVP_MAC_free_ctx() returns nothing at all.
-EVP_MAC_CTX_get_params() and EVP_MAC_CTX_set_params() return 1 on
+EVP_MAC_get_ctx_params() and EVP_MAC_set_ctx_params() return 1 on
success, 0 on error.
EVP_MAC_init(), EVP_MAC_update(), and EVP_MAC_final() return 1 on success, 0
if (cipher != NULL)
params[params_n++] =
- OSSL_PARAM_construct_utf8_string("cipher", cipher, 0, NULL);
+ OSSL_PARAM_construct_utf8_string("cipher", cipher, 0;
if (digest != NULL)
params[params_n++] =
- OSSL_PARAM_construct_utf8_string("digest", digest, 0, NULL);
+ OSSL_PARAM_construct_utf8_string("digest", digest, 0);
params[params_n++] =
- OSSL_PARAM_construct_octet_string("key", key, strlen(key), NULL);
+ OSSL_PARAM_construct_octet_string("key", key, strlen(key));
params[params_n] = OSSL_PARAM_construct_end();
if (mac == NULL
|| key == NULL
- || (ctx = EVP_MAC_CTX_new(mac)) == NULL
- || EVP_MAC_CTX_set_params(ctx, params) <= 0)
+ || (ctx = EVP_MAC_new_ctx(mac)) == NULL
+ || EVP_MAC_set_ctx_params(ctx, params) <= 0)
goto err;
if (!EVP_MAC_init(ctx))
goto err;
- while ( (read_l = read(STDIN_FILENO, buf, sizeof(buf))) < 0) {
+ while ( (read_l = read(STDIN_FILENO, buf, sizeof(buf))) > 0) {
if (!EVP_MAC_update(ctx, buf, read_l))
goto err;
}
printf("%02X", buf[i]);
printf("\n");
- EVP_MAC_CTX_free(ctx);
+ EVP_MAC_free_ctx(ctx);
EVP_MAC_free(mac);
exit(0);
err:
- EVP_MAC_CTX_free(ctx);
+ EVP_MAC_free_ctx(ctx);
EVP_MAC_free(mac);
fprintf(stderr, "Something went wrong\n");
ERR_print_errors_fp(stderr);
$ MY_MAC=cmac MY_KEY=secret0123456789 MY_MAC_CIPHER=aes-128-cbc \
LD_LIBRARY_PATH=. ./foo < foo.c
- Result: ECCAAFF041B22A2299EB90A1B53B6D45
+ Result: C5C06683CD9DDEF904D754505C560A4E
(in this example, that program was stored in F<foo.c> and compiled to
F<./foo>)
L<property(7)>
L<OSSL_PARAM(3)>,
-L<EVP_MAC_BLAKE2(7)>,
-L<EVP_MAC_CMAC(7)>,
-L<EVP_MAC_GMAC(7)>,
-L<EVP_MAC_HMAC(7)>,
-L<EVP_MAC_KMAC(7)>,
-L<EVP_MAC_SIPHASH(7)>,
-L<EVP_MAC_POLY1305(7)>
+L<EVP_MAC-BLAKE2(7)>,
+L<EVP_MAC-CMAC(7)>,
+L<EVP_MAC-GMAC(7)>,
+L<EVP_MAC-HMAC(7)>,
+L<EVP_MAC-KMAC(7)>,
+L<EVP_MAC-Siphash(7)>,
+L<EVP_MAC-Poly1305(7)>
=head1 HISTORY
=head1 COPYRIGHT
-Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy