Coverage Report

Created: 2026-10-28 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl36/providers/implementations/macs/blake2_mac_impl.c
Line
Count
Source
1
/*
2
 * Copyright 2018-2025 The OpenSSL Project Authors. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License 2.0 (the "License").  You may not use
5
 * this file except in compliance with the License.  You can obtain a copy
6
 * in the file LICENSE in the source distribution or at
7
 * https://www.openssl.org/source/license.html
8
 */
9
10
#include <openssl/core_dispatch.h>
11
#include <openssl/core_names.h>
12
#include <openssl/params.h>
13
#include <openssl/proverr.h>
14
15
#include "prov/blake2.h"
16
#include "internal/cryptlib.h"
17
#include "prov/implementations.h"
18
#include "prov/providercommon.h"
19
20
#include "prov/blake2_params.inc"
21
22
/*
23
 * Forward declaration of everything implemented here.  This is not strictly
24
 * necessary for the compiler, but provides an assurance that the signatures
25
 * of the functions in the dispatch table are correct.
26
 */
27
static OSSL_FUNC_mac_newctx_fn blake2_mac_new;
28
static OSSL_FUNC_mac_dupctx_fn blake2_mac_dup;
29
static OSSL_FUNC_mac_freectx_fn blake2_mac_free;
30
static OSSL_FUNC_mac_gettable_ctx_params_fn blake2_gettable_ctx_params;
31
static OSSL_FUNC_mac_get_ctx_params_fn blake2_get_ctx_params;
32
static OSSL_FUNC_mac_settable_ctx_params_fn blake2_mac_settable_ctx_params;
33
static OSSL_FUNC_mac_set_ctx_params_fn blake2_mac_set_ctx_params;
34
static OSSL_FUNC_mac_init_fn blake2_mac_init;
35
static OSSL_FUNC_mac_update_fn blake2_mac_update;
36
static OSSL_FUNC_mac_final_fn blake2_mac_final;
37
38
struct blake2_mac_data_st {
39
    BLAKE2_CTX ctx;
40
    BLAKE2_PARAM params;
41
    unsigned char key[BLAKE2_KEYBYTES];
42
};
43
44
static void *blake2_mac_new(void *unused_provctx)
45
549
{
46
549
    struct blake2_mac_data_st *macctx;
47
48
549
    if (!ossl_prov_is_running())
49
0
        return NULL;
50
51
549
    macctx = OPENSSL_zalloc(sizeof(*macctx));
52
549
    if (macctx != NULL) {
53
549
        BLAKE2_PARAM_INIT(&macctx->params);
54
        /* ctx initialization is deferred to BLAKE2b_Init() */
55
549
    }
56
549
    return macctx;
57
549
}
blake2b_mac.c:blake2_mac_new
Line
Count
Source
45
300
{
46
300
    struct blake2_mac_data_st *macctx;
47
48
300
    if (!ossl_prov_is_running())
49
0
        return NULL;
50
51
300
    macctx = OPENSSL_zalloc(sizeof(*macctx));
52
300
    if (macctx != NULL) {
53
300
        BLAKE2_PARAM_INIT(&macctx->params);
54
        /* ctx initialization is deferred to BLAKE2b_Init() */
55
300
    }
56
300
    return macctx;
57
300
}
blake2s_mac.c:blake2_mac_new
Line
Count
Source
45
249
{
46
249
    struct blake2_mac_data_st *macctx;
47
48
249
    if (!ossl_prov_is_running())
49
0
        return NULL;
50
51
249
    macctx = OPENSSL_zalloc(sizeof(*macctx));
52
249
    if (macctx != NULL) {
53
249
        BLAKE2_PARAM_INIT(&macctx->params);
54
        /* ctx initialization is deferred to BLAKE2b_Init() */
55
249
    }
56
249
    return macctx;
57
249
}
58
59
static void *blake2_mac_dup(void *vsrc)
60
0
{
61
0
    struct blake2_mac_data_st *dst;
62
0
    struct blake2_mac_data_st *src = vsrc;
63
64
0
    if (!ossl_prov_is_running())
65
0
        return NULL;
66
67
0
    dst = OPENSSL_zalloc(sizeof(*dst));
68
0
    if (dst == NULL)
69
0
        return NULL;
70
71
0
    *dst = *src;
72
0
    return dst;
73
0
}
Unexecuted instantiation: blake2b_mac.c:blake2_mac_dup
Unexecuted instantiation: blake2s_mac.c:blake2_mac_dup
74
75
static void blake2_mac_free(void *vmacctx)
76
549
{
77
549
    struct blake2_mac_data_st *macctx = vmacctx;
78
79
549
    if (macctx != NULL) {
80
549
        OPENSSL_cleanse(macctx->key, sizeof(macctx->key));
81
549
        OPENSSL_free(macctx);
82
549
    }
83
549
}
blake2b_mac.c:blake2_mac_free
Line
Count
Source
76
300
{
77
300
    struct blake2_mac_data_st *macctx = vmacctx;
78
79
300
    if (macctx != NULL) {
80
300
        OPENSSL_cleanse(macctx->key, sizeof(macctx->key));
81
300
        OPENSSL_free(macctx);
82
300
    }
83
300
}
blake2s_mac.c:blake2_mac_free
Line
Count
Source
76
249
{
77
249
    struct blake2_mac_data_st *macctx = vmacctx;
78
79
249
    if (macctx != NULL) {
80
249
        OPENSSL_cleanse(macctx->key, sizeof(macctx->key));
81
249
        OPENSSL_free(macctx);
82
249
    }
83
249
}
84
85
static size_t blake2_mac_size(void *vmacctx)
86
12.3k
{
87
12.3k
    struct blake2_mac_data_st *macctx = vmacctx;
88
89
12.3k
    return macctx->params.digest_length;
90
12.3k
}
blake2b_mac.c:blake2_mac_size
Line
Count
Source
86
6.96k
{
87
6.96k
    struct blake2_mac_data_st *macctx = vmacctx;
88
89
6.96k
    return macctx->params.digest_length;
90
6.96k
}
blake2s_mac.c:blake2_mac_size
Line
Count
Source
86
5.36k
{
87
5.36k
    struct blake2_mac_data_st *macctx = vmacctx;
88
89
5.36k
    return macctx->params.digest_length;
90
5.36k
}
91
92
static int blake2_setkey(struct blake2_mac_data_st *macctx,
93
    const unsigned char *key, size_t keylen)
94
6.79k
{
95
6.79k
    if (keylen > BLAKE2_KEYBYTES || keylen == 0) {
96
124
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
97
124
        return 0;
98
124
    }
99
6.67k
    memcpy(macctx->key, key, keylen);
100
    /* Pad with zeroes at the end if required */
101
6.67k
    if (keylen < BLAKE2_KEYBYTES)
102
5.99k
        memset(macctx->key + keylen, 0, BLAKE2_KEYBYTES - keylen);
103
6.67k
    BLAKE2_PARAM_SET_KEY_LENGTH(&macctx->params, (uint8_t)keylen);
104
6.67k
    return 1;
105
6.79k
}
blake2b_mac.c:blake2_setkey
Line
Count
Source
94
3.84k
{
95
3.84k
    if (keylen > BLAKE2_KEYBYTES || keylen == 0) {
96
64
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
97
64
        return 0;
98
64
    }
99
3.77k
    memcpy(macctx->key, key, keylen);
100
    /* Pad with zeroes at the end if required */
101
3.77k
    if (keylen < BLAKE2_KEYBYTES)
102
3.53k
        memset(macctx->key + keylen, 0, BLAKE2_KEYBYTES - keylen);
103
3.77k
    BLAKE2_PARAM_SET_KEY_LENGTH(&macctx->params, (uint8_t)keylen);
104
3.77k
    return 1;
105
3.84k
}
blake2s_mac.c:blake2_setkey
Line
Count
Source
94
2.95k
{
95
2.95k
    if (keylen > BLAKE2_KEYBYTES || keylen == 0) {
96
60
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
97
60
        return 0;
98
60
    }
99
2.89k
    memcpy(macctx->key, key, keylen);
100
    /* Pad with zeroes at the end if required */
101
2.89k
    if (keylen < BLAKE2_KEYBYTES)
102
2.46k
        memset(macctx->key + keylen, 0, BLAKE2_KEYBYTES - keylen);
103
2.89k
    BLAKE2_PARAM_SET_KEY_LENGTH(&macctx->params, (uint8_t)keylen);
104
2.89k
    return 1;
105
2.95k
}
106
107
static int blake2_mac_init(void *vmacctx, const unsigned char *key,
108
    size_t keylen, const OSSL_PARAM params[])
109
6.46k
{
110
6.46k
    struct blake2_mac_data_st *macctx = vmacctx;
111
112
6.46k
    if (!ossl_prov_is_running() || !blake2_mac_set_ctx_params(macctx, params))
113
296
        return 0;
114
6.17k
    if (key != NULL) {
115
6.17k
        if (!blake2_setkey(macctx, key, keylen))
116
3
            return 0;
117
6.17k
    } else if (macctx->params.key_length == 0) {
118
        /* Check key has been set */
119
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET);
120
0
        return 0;
121
0
    }
122
6.17k
    return BLAKE2_INIT_KEY(&macctx->ctx, &macctx->params, macctx->key);
123
6.17k
}
blake2b_mac.c:blake2_mac_init
Line
Count
Source
109
3.64k
{
110
3.64k
    struct blake2_mac_data_st *macctx = vmacctx;
111
112
3.64k
    if (!ossl_prov_is_running() || !blake2_mac_set_ctx_params(macctx, params))
113
160
        return 0;
114
3.48k
    if (key != NULL) {
115
3.48k
        if (!blake2_setkey(macctx, key, keylen))
116
0
            return 0;
117
3.48k
    } else if (macctx->params.key_length == 0) {
118
        /* Check key has been set */
119
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET);
120
0
        return 0;
121
0
    }
122
3.48k
    return BLAKE2_INIT_KEY(&macctx->ctx, &macctx->params, macctx->key);
123
3.48k
}
blake2s_mac.c:blake2_mac_init
Line
Count
Source
109
2.82k
{
110
2.82k
    struct blake2_mac_data_st *macctx = vmacctx;
111
112
2.82k
    if (!ossl_prov_is_running() || !blake2_mac_set_ctx_params(macctx, params))
113
136
        return 0;
114
2.68k
    if (key != NULL) {
115
2.68k
        if (!blake2_setkey(macctx, key, keylen))
116
3
            return 0;
117
2.68k
    } else if (macctx->params.key_length == 0) {
118
        /* Check key has been set */
119
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET);
120
0
        return 0;
121
0
    }
122
2.68k
    return BLAKE2_INIT_KEY(&macctx->ctx, &macctx->params, macctx->key);
123
2.68k
}
124
125
static int blake2_mac_update(void *vmacctx,
126
    const unsigned char *data, size_t datalen)
127
6.54k
{
128
6.54k
    struct blake2_mac_data_st *macctx = vmacctx;
129
130
6.54k
    if (datalen == 0)
131
0
        return 1;
132
133
6.54k
    return BLAKE2_UPDATE(&macctx->ctx, data, datalen);
134
6.54k
}
blake2b_mac.c:blake2_mac_update
Line
Count
Source
127
3.69k
{
128
3.69k
    struct blake2_mac_data_st *macctx = vmacctx;
129
130
3.69k
    if (datalen == 0)
131
0
        return 1;
132
133
3.69k
    return BLAKE2_UPDATE(&macctx->ctx, data, datalen);
134
3.69k
}
blake2s_mac.c:blake2_mac_update
Line
Count
Source
127
2.85k
{
128
2.85k
    struct blake2_mac_data_st *macctx = vmacctx;
129
130
2.85k
    if (datalen == 0)
131
0
        return 1;
132
133
2.85k
    return BLAKE2_UPDATE(&macctx->ctx, data, datalen);
134
2.85k
}
135
136
static int blake2_mac_final(void *vmacctx,
137
    unsigned char *out, size_t *outl,
138
    size_t outsize)
139
6.15k
{
140
6.15k
    struct blake2_mac_data_st *macctx = vmacctx;
141
142
6.15k
    if (!ossl_prov_is_running())
143
0
        return 0;
144
145
6.15k
    *outl = blake2_mac_size(macctx);
146
6.15k
    return BLAKE2_FINAL(out, &macctx->ctx);
147
6.15k
}
blake2b_mac.c:blake2_mac_final
Line
Count
Source
139
3.47k
{
140
3.47k
    struct blake2_mac_data_st *macctx = vmacctx;
141
142
3.47k
    if (!ossl_prov_is_running())
143
0
        return 0;
144
145
3.47k
    *outl = blake2_mac_size(macctx);
146
3.47k
    return BLAKE2_FINAL(out, &macctx->ctx);
147
3.47k
}
blake2s_mac.c:blake2_mac_final
Line
Count
Source
139
2.68k
{
140
2.68k
    struct blake2_mac_data_st *macctx = vmacctx;
141
142
2.68k
    if (!ossl_prov_is_running())
143
0
        return 0;
144
145
2.68k
    *outl = blake2_mac_size(macctx);
146
2.68k
    return BLAKE2_FINAL(out, &macctx->ctx);
147
2.68k
}
148
149
/* See blake2.h for parameter definition */
150
static const OSSL_PARAM *blake2_gettable_ctx_params(ossl_unused void *ctx,
151
    ossl_unused void *provctx)
152
0
{
153
0
    return blake2_get_ctx_list;
154
0
}
Unexecuted instantiation: blake2b_mac.c:blake2_gettable_ctx_params
Unexecuted instantiation: blake2s_mac.c:blake2_gettable_ctx_params
155
156
static int blake2_get_ctx_params(void *vmacctx, OSSL_PARAM params[])
157
2.13k
{
158
2.13k
    struct blake2_mac_data_st *macctx = vmacctx;
159
2.13k
    struct blake2_get_ctx_st p;
160
161
2.13k
    if (macctx == NULL || !blake2_get_ctx_decoder(params, &p))
162
0
        return 0;
163
164
2.13k
    if (p.size != NULL
165
2.13k
        && !OSSL_PARAM_set_size_t(p.size, blake2_mac_size(macctx)))
166
0
        return 0;
167
168
2.13k
    if (p.bsize != NULL && !OSSL_PARAM_set_size_t(p.bsize, BLAKE2_BLOCKBYTES))
169
0
        return 0;
170
171
2.13k
    return 1;
172
2.13k
}
blake2b_mac.c:blake2_get_ctx_params
Line
Count
Source
157
1.30k
{
158
1.30k
    struct blake2_mac_data_st *macctx = vmacctx;
159
1.30k
    struct blake2_get_ctx_st p;
160
161
1.30k
    if (macctx == NULL || !blake2_get_ctx_decoder(params, &p))
162
0
        return 0;
163
164
1.30k
    if (p.size != NULL
165
1.30k
        && !OSSL_PARAM_set_size_t(p.size, blake2_mac_size(macctx)))
166
0
        return 0;
167
168
1.30k
    if (p.bsize != NULL && !OSSL_PARAM_set_size_t(p.bsize, BLAKE2_BLOCKBYTES))
169
0
        return 0;
170
171
1.30k
    return 1;
172
1.30k
}
blake2s_mac.c:blake2_get_ctx_params
Line
Count
Source
157
833
{
158
833
    struct blake2_mac_data_st *macctx = vmacctx;
159
833
    struct blake2_get_ctx_st p;
160
161
833
    if (macctx == NULL || !blake2_get_ctx_decoder(params, &p))
162
0
        return 0;
163
164
833
    if (p.size != NULL
165
833
        && !OSSL_PARAM_set_size_t(p.size, blake2_mac_size(macctx)))
166
0
        return 0;
167
168
833
    if (p.bsize != NULL && !OSSL_PARAM_set_size_t(p.bsize, BLAKE2_BLOCKBYTES))
169
0
        return 0;
170
171
833
    return 1;
172
833
}
173
174
static const OSSL_PARAM *blake2_mac_settable_ctx_params(
175
    ossl_unused void *ctx, ossl_unused void *p_ctx)
176
494
{
177
494
    return blake2_mac_set_ctx_list;
178
494
}
blake2b_mac.c:blake2_mac_settable_ctx_params
Line
Count
Source
176
272
{
177
272
    return blake2_mac_set_ctx_list;
178
272
}
blake2s_mac.c:blake2_mac_settable_ctx_params
Line
Count
Source
176
222
{
177
222
    return blake2_mac_set_ctx_list;
178
222
}
179
180
/*
181
 * ALL parameters should be set before init().
182
 */
183
static int blake2_mac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[])
184
2.45k
{
185
2.45k
    struct blake2_mac_data_st *macctx = vmacctx;
186
2.45k
    struct blake2_mac_set_ctx_st p;
187
188
2.45k
    if (macctx == NULL || !blake2_mac_set_ctx_decoder(params, &p))
189
0
        return 0;
190
191
2.45k
    if (p.size != NULL) {
192
427
        size_t size;
193
194
427
        if (!OSSL_PARAM_get_size_t(p.size, &size)
195
427
            || size < 1
196
412
            || size > BLAKE2_OUTBYTES) {
197
49
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_XOF_OR_INVALID_LENGTH);
198
49
            return 0;
199
49
        }
200
378
        BLAKE2_PARAM_SET_DIGEST_LENGTH(&macctx->params, (uint8_t)size);
201
378
    }
202
203
2.40k
    if (p.key != NULL)
204
378
        if (p.key->data_type != OSSL_PARAM_OCTET_STRING
205
378
            || !blake2_setkey(macctx, p.key->data, p.key->data_size))
206
67
            return 0;
207
208
2.34k
    if (p.cust != NULL) {
209
311
        if (p.cust->data_type != OSSL_PARAM_OCTET_STRING)
210
0
            return 0;
211
        /*
212
         * The OSSL_PARAM API doesn't provide direct pointer use, so we
213
         * must handle the OSSL_PARAM structure ourselves here
214
         */
215
311
        if (p.cust->data_size > BLAKE2_PERSONALBYTES) {
216
36
            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_CUSTOM_LENGTH);
217
36
            return 0;
218
36
        }
219
275
        BLAKE2_PARAM_SET_PERSONAL(&macctx->params, p.cust->data,
220
275
            p.cust->data_size);
221
275
    }
222
223
2.30k
    if (p.salt != NULL) {
224
275
        if (p.salt->data_type != OSSL_PARAM_OCTET_STRING)
225
0
            return 0;
226
        /*
227
         * The OSSL_PARAM API doesn't provide direct pointer use, so we
228
         * must handle the OSSL_PARAM structure ourselves here as well
229
         */
230
275
        if (p.salt->data_size > BLAKE2_SALTBYTES) {
231
23
            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SALT_LENGTH);
232
23
            return 0;
233
23
        }
234
252
        BLAKE2_PARAM_SET_SALT(&macctx->params, p.salt->data, p.salt->data_size);
235
252
    }
236
2.28k
    return 1;
237
2.30k
}
blake2b_mac.c:blake2_mac_set_ctx_params
Line
Count
Source
184
1.47k
{
185
1.47k
    struct blake2_mac_data_st *macctx = vmacctx;
186
1.47k
    struct blake2_mac_set_ctx_st p;
187
188
1.47k
    if (macctx == NULL || !blake2_mac_set_ctx_decoder(params, &p))
189
0
        return 0;
190
191
1.47k
    if (p.size != NULL) {
192
232
        size_t size;
193
194
232
        if (!OSSL_PARAM_get_size_t(p.size, &size)
195
232
            || size < 1
196
225
            || size > BLAKE2_OUTBYTES) {
197
22
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_XOF_OR_INVALID_LENGTH);
198
22
            return 0;
199
22
        }
200
210
        BLAKE2_PARAM_SET_DIGEST_LENGTH(&macctx->params, (uint8_t)size);
201
210
    }
202
203
1.45k
    if (p.key != NULL)
204
210
        if (p.key->data_type != OSSL_PARAM_OCTET_STRING
205
210
            || !blake2_setkey(macctx, p.key->data, p.key->data_size))
206
35
            return 0;
207
208
1.42k
    if (p.cust != NULL) {
209
175
        if (p.cust->data_type != OSSL_PARAM_OCTET_STRING)
210
0
            return 0;
211
        /*
212
         * The OSSL_PARAM API doesn't provide direct pointer use, so we
213
         * must handle the OSSL_PARAM structure ourselves here
214
         */
215
175
        if (p.cust->data_size > BLAKE2_PERSONALBYTES) {
216
23
            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_CUSTOM_LENGTH);
217
23
            return 0;
218
23
        }
219
152
        BLAKE2_PARAM_SET_PERSONAL(&macctx->params, p.cust->data,
220
152
            p.cust->data_size);
221
152
    }
222
223
1.39k
    if (p.salt != NULL) {
224
152
        if (p.salt->data_type != OSSL_PARAM_OCTET_STRING)
225
0
            return 0;
226
        /*
227
         * The OSSL_PARAM API doesn't provide direct pointer use, so we
228
         * must handle the OSSL_PARAM structure ourselves here as well
229
         */
230
152
        if (p.salt->data_size > BLAKE2_SALTBYTES) {
231
14
            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SALT_LENGTH);
232
14
            return 0;
233
14
        }
234
138
        BLAKE2_PARAM_SET_SALT(&macctx->params, p.salt->data, p.salt->data_size);
235
138
    }
236
1.38k
    return 1;
237
1.39k
}
blake2s_mac.c:blake2_mac_set_ctx_params
Line
Count
Source
184
980
{
185
980
    struct blake2_mac_data_st *macctx = vmacctx;
186
980
    struct blake2_mac_set_ctx_st p;
187
188
980
    if (macctx == NULL || !blake2_mac_set_ctx_decoder(params, &p))
189
0
        return 0;
190
191
980
    if (p.size != NULL) {
192
195
        size_t size;
193
194
195
        if (!OSSL_PARAM_get_size_t(p.size, &size)
195
195
            || size < 1
196
187
            || size > BLAKE2_OUTBYTES) {
197
27
            ERR_raise(ERR_LIB_PROV, PROV_R_NOT_XOF_OR_INVALID_LENGTH);
198
27
            return 0;
199
27
        }
200
168
        BLAKE2_PARAM_SET_DIGEST_LENGTH(&macctx->params, (uint8_t)size);
201
168
    }
202
203
953
    if (p.key != NULL)
204
168
        if (p.key->data_type != OSSL_PARAM_OCTET_STRING
205
168
            || !blake2_setkey(macctx, p.key->data, p.key->data_size))
206
32
            return 0;
207
208
921
    if (p.cust != NULL) {
209
136
        if (p.cust->data_type != OSSL_PARAM_OCTET_STRING)
210
0
            return 0;
211
        /*
212
         * The OSSL_PARAM API doesn't provide direct pointer use, so we
213
         * must handle the OSSL_PARAM structure ourselves here
214
         */
215
136
        if (p.cust->data_size > BLAKE2_PERSONALBYTES) {
216
13
            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_CUSTOM_LENGTH);
217
13
            return 0;
218
13
        }
219
123
        BLAKE2_PARAM_SET_PERSONAL(&macctx->params, p.cust->data,
220
123
            p.cust->data_size);
221
123
    }
222
223
908
    if (p.salt != NULL) {
224
123
        if (p.salt->data_type != OSSL_PARAM_OCTET_STRING)
225
0
            return 0;
226
        /*
227
         * The OSSL_PARAM API doesn't provide direct pointer use, so we
228
         * must handle the OSSL_PARAM structure ourselves here as well
229
         */
230
123
        if (p.salt->data_size > BLAKE2_SALTBYTES) {
231
9
            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_SALT_LENGTH);
232
9
            return 0;
233
9
        }
234
114
        BLAKE2_PARAM_SET_SALT(&macctx->params, p.salt->data, p.salt->data_size);
235
114
    }
236
899
    return 1;
237
908
}
238
239
const OSSL_DISPATCH BLAKE2_FUNCTIONS[] = {
240
    { OSSL_FUNC_MAC_NEWCTX, (void (*)(void))blake2_mac_new },
241
    { OSSL_FUNC_MAC_DUPCTX, (void (*)(void))blake2_mac_dup },
242
    { OSSL_FUNC_MAC_FREECTX, (void (*)(void))blake2_mac_free },
243
    { OSSL_FUNC_MAC_INIT, (void (*)(void))blake2_mac_init },
244
    { OSSL_FUNC_MAC_UPDATE, (void (*)(void))blake2_mac_update },
245
    { OSSL_FUNC_MAC_FINAL, (void (*)(void))blake2_mac_final },
246
    { OSSL_FUNC_MAC_GETTABLE_CTX_PARAMS,
247
        (void (*)(void))blake2_gettable_ctx_params },
248
    { OSSL_FUNC_MAC_GET_CTX_PARAMS, (void (*)(void))blake2_get_ctx_params },
249
    { OSSL_FUNC_MAC_SETTABLE_CTX_PARAMS,
250
        (void (*)(void))blake2_mac_settable_ctx_params },
251
    { OSSL_FUNC_MAC_SET_CTX_PARAMS, (void (*)(void))blake2_mac_set_ctx_params },
252
    OSSL_DISPATCH_END
253
};