Coverage Report

Created: 2026-10-28 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl41/providers/implementations/ciphers/cipher_aes_wrp.c
Line
Count
Source
1
/*
2
 * Copyright 2019-2026 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
/*
11
 * This file uses the low level AES functions (which are deprecated for
12
 * non-internal use) in order to implement provider AES ciphers.
13
 */
14
#include "internal/deprecated.h"
15
16
#include <openssl/proverr.h>
17
#include "cipher_aes.h"
18
#include "prov/providercommon.h"
19
#include "prov/implementations.h"
20
#include "providers/implementations/ciphers/cipher_aes_wrp.inc"
21
22
/* AES wrap with padding has IV length of 4, without padding 8 */
23
194
#define AES_WRAP_PAD_IVLEN 4
24
#define AES_WRAP_NOPAD_IVLEN 8
25
26
#define WRAP_FLAGS (PROV_CIPHER_FLAG_CUSTOM_IV)
27
#define WRAP_FLAGS_INV (WRAP_FLAGS | PROV_CIPHER_FLAG_INVERSE_CIPHER)
28
29
typedef size_t (*aeswrap_fn)(void *key, const unsigned char *iv,
30
    unsigned char *out, const unsigned char *in,
31
    size_t inlen, block128_f block);
32
33
static OSSL_FUNC_cipher_encrypt_init_fn aes_wrap_einit;
34
static OSSL_FUNC_cipher_decrypt_init_fn aes_wrap_dinit;
35
static OSSL_FUNC_cipher_update_fn aes_wrap_cipher;
36
static OSSL_FUNC_cipher_final_fn aes_wrap_final;
37
static OSSL_FUNC_cipher_freectx_fn aes_wrap_freectx;
38
static OSSL_FUNC_cipher_set_ctx_params_fn aes_wrap_set_ctx_params;
39
40
typedef struct prov_aes_wrap_ctx_st {
41
    PROV_CIPHER_CTX base;
42
    union {
43
        OSSL_UNION_ALIGN;
44
        AES_KEY ks;
45
    } ks;
46
    aeswrap_fn wrapfn;
47
    int updated;
48
49
} PROV_AES_WRAP_CTX;
50
51
static void *aes_wrap_newctx(void *provctx, size_t kbits, size_t blkbits,
52
    size_t ivbits, unsigned int mode, uint64_t flags)
53
194
{
54
194
    PROV_AES_WRAP_CTX *wctx;
55
194
    PROV_CIPHER_CTX *ctx;
56
57
194
    CIPHER_PROV_CHECK(provctx, AES_128_WRP);
58
194
    wctx = OPENSSL_zalloc(sizeof(*wctx));
59
194
    ctx = (PROV_CIPHER_CTX *)wctx;
60
194
    if (ctx != NULL) {
61
194
        ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, mode, flags,
62
194
            NULL, NULL);
63
194
        ctx->pad = (ctx->ivlen == AES_WRAP_PAD_IVLEN);
64
194
    }
65
194
    return wctx;
66
194
}
67
68
static void *aes_wrap_dupctx(void *wctx)
69
0
{
70
0
    PROV_AES_WRAP_CTX *ctx = wctx;
71
0
    PROV_AES_WRAP_CTX *dctx = wctx;
72
73
0
    if (!ossl_prov_is_running())
74
0
        return NULL;
75
76
0
    if (ctx == NULL)
77
0
        return NULL;
78
0
    dctx = OPENSSL_memdup(ctx, sizeof(*ctx));
79
0
    if (dctx != NULL
80
0
        && !ossl_cipher_generic_dupctx_tlsmac(&dctx->base, &ctx->base)) {
81
0
        OPENSSL_clear_free(dctx, sizeof(*dctx));
82
0
        return NULL;
83
0
    }
84
0
    return dctx;
85
0
}
86
87
static void aes_wrap_freectx(void *vctx)
88
194
{
89
194
    PROV_AES_WRAP_CTX *wctx = (PROV_AES_WRAP_CTX *)vctx;
90
91
194
    ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx);
92
194
    OPENSSL_clear_free(wctx, sizeof(*wctx));
93
194
}
94
95
static int aes_wrap_init(void *vctx, const unsigned char *key,
96
    size_t keylen, const unsigned char *iv,
97
    size_t ivlen, const OSSL_PARAM params[], int enc)
98
312
{
99
312
    PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
100
312
    PROV_AES_WRAP_CTX *wctx = (PROV_AES_WRAP_CTX *)vctx;
101
102
312
    if (!ossl_prov_is_running())
103
0
        return 0;
104
105
312
    wctx->updated = 0;
106
312
    ctx->enc = enc;
107
312
    if (ctx->pad)
108
84
        wctx->wrapfn = enc ? CRYPTO_128_wrap_pad : CRYPTO_128_unwrap_pad;
109
228
    else
110
228
        wctx->wrapfn = enc ? CRYPTO_128_wrap : CRYPTO_128_unwrap;
111
112
312
    if (iv != NULL) {
113
43
        if (!ossl_cipher_generic_initiv(ctx, iv, ivlen))
114
0
            return 0;
115
43
    }
116
312
    if (key != NULL) {
117
161
        int use_forward_transform;
118
119
161
        if (keylen != ctx->keylen) {
120
0
            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
121
0
            return 0;
122
0
        }
123
        /*
124
         * See SP800-38F : Section 5.1
125
         * The forward and inverse transformations for the AES block
126
         * cipher—called “cipher” and “inverse  cipher” are informally known as
127
         * the AES encryption and AES decryption functions, respectively.
128
         * If the designated cipher function for a key-wrap algorithm is chosen
129
         * to be the AES decryption function, then CIPH-1K will be the AES
130
         * encryption function.
131
         */
132
161
        if (ctx->inverse_cipher == 0)
133
142
            use_forward_transform = ctx->enc;
134
19
        else
135
19
            use_forward_transform = !ctx->enc;
136
161
        if (use_forward_transform) {
137
30
            AES_set_encrypt_key(key, (int)(keylen * 8), &wctx->ks.ks);
138
30
            ctx->block = (block128_f)AES_encrypt;
139
131
        } else {
140
131
            AES_set_decrypt_key(key, (int)(keylen * 8), &wctx->ks.ks);
141
131
            ctx->block = (block128_f)AES_decrypt;
142
131
        }
143
161
        ctx->key_set = 1;
144
161
    }
145
312
    return aes_wrap_set_ctx_params(ctx, params);
146
312
}
147
148
static int aes_wrap_einit(void *ctx, const unsigned char *key, size_t keylen,
149
    const unsigned char *iv, size_t ivlen,
150
    const OSSL_PARAM params[])
151
58
{
152
58
    return aes_wrap_init(ctx, key, keylen, iv, ivlen, params, 1);
153
58
}
154
155
static int aes_wrap_dinit(void *ctx, const unsigned char *key, size_t keylen,
156
    const unsigned char *iv, size_t ivlen,
157
    const OSSL_PARAM params[])
158
254
{
159
254
    return aes_wrap_init(ctx, key, keylen, iv, ivlen, params, 0);
160
254
}
161
162
static int aes_wrap_cipher_internal(void *vctx, unsigned char *out,
163
    const unsigned char *in, size_t inlen)
164
119
{
165
119
    PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
166
119
    PROV_AES_WRAP_CTX *wctx = (PROV_AES_WRAP_CTX *)vctx;
167
119
    size_t rv;
168
119
    int pad = ctx->pad;
169
170
    /* No final operation so always return zero length */
171
119
    if (in == NULL)
172
0
        return 0;
173
174
    /* Input length must always be non-zero */
175
119
    if (inlen == 0 || inlen > INT_MAX) {
176
0
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_INPUT_LENGTH);
177
0
        return -1;
178
0
    }
179
180
    /* If decrypting need at least 16 bytes and multiple of 8 */
181
119
    if (!ctx->enc && (inlen < 16 || inlen & 0x7)) {
182
0
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_INPUT_LENGTH);
183
0
        return -1;
184
0
    }
185
186
    /* If not padding input must be multiple of 8 */
187
119
    if (!pad && inlen & 0x7) {
188
2
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_INPUT_LENGTH);
189
2
        return -1;
190
2
    }
191
192
117
    if (out == NULL) {
193
0
        if (ctx->enc) {
194
            /* If padding round up to multiple of 8 */
195
0
            if (pad)
196
0
                inlen = (inlen + 7) / 8 * 8;
197
            /* 8 byte prefix */
198
0
            return (int)(inlen + 8);
199
0
        } else {
200
            /*
201
             * If not padding output will be exactly 8 bytes smaller than
202
             * input. If padding it will be at least 8 bytes smaller but we
203
             * don't know how much.
204
             */
205
0
            return (int)(inlen - 8);
206
0
        }
207
0
    }
208
209
    /*
210
     * Multiple calls to update are not allowed, since the algorithm
211
     * relies on all fields being present.
212
     */
213
117
    if (wctx->updated) {
214
0
        ERR_raise(ERR_LIB_PROV, PROV_R_UPDATE_CALL_OUT_OF_ORDER);
215
0
        return -1;
216
0
    }
217
117
    if (!ctx->key_set) {
218
0
        ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET);
219
0
        return -1;
220
0
    }
221
117
    wctx->updated = 1;
222
223
117
    rv = wctx->wrapfn(&wctx->ks.ks, ctx->iv_set ? ctx->iv : NULL, out, in,
224
117
        inlen, ctx->block);
225
117
    if (!rv) {
226
114
        ERR_raise(ERR_LIB_PROV, PROV_R_CIPHER_OPERATION_FAILED);
227
114
        return -1;
228
114
    }
229
3
    if (rv > INT_MAX) {
230
0
        ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_OUTPUT_LENGTH);
231
0
        return -1;
232
0
    }
233
3
    return (int)rv;
234
3
}
235
236
static int aes_wrap_final(void *vctx, unsigned char *out, size_t *outl,
237
    size_t outsize)
238
3
{
239
3
    if (!ossl_prov_is_running())
240
0
        return 0;
241
242
3
    *outl = 0;
243
3
    return 1;
244
3
}
245
246
static int aes_wrap_cipher(void *vctx,
247
    unsigned char *out, size_t *outl, size_t outsize,
248
    const unsigned char *in, size_t inl)
249
121
{
250
121
    PROV_AES_WRAP_CTX *ctx = (PROV_AES_WRAP_CTX *)vctx;
251
121
    int len;
252
253
121
    if (!ossl_prov_is_running())
254
0
        return 0;
255
256
121
    if (inl == 0) {
257
0
        *outl = 0;
258
0
        return 1;
259
0
    }
260
261
121
    if (outsize < inl) {
262
0
        ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
263
0
        return 0;
264
0
    }
265
266
121
    len = aes_wrap_cipher_internal(ctx, out, in, inl);
267
121
    if (len <= 0)
268
116
        return 0;
269
270
5
    *outl = (size_t)len;
271
5
    return 1;
272
121
}
273
274
static const OSSL_PARAM *aes_wrap_settable_ctx_params(ossl_unused void *cctx,
275
    ossl_unused void *provctx)
276
45
{
277
45
    return aes_wrap_set_ctx_params_list;
278
45
}
279
280
static int aes_wrap_set_ctx_params(void *vctx, const OSSL_PARAM params[])
281
354
{
282
354
    PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
283
354
    struct aes_wrap_set_ctx_params_st p;
284
354
    size_t keylen = 0;
285
286
354
    if (ctx == NULL || !aes_wrap_set_ctx_params_decoder(params, &p))
287
0
        return 0;
288
289
354
    if (p.keylen != NULL) {
290
44
        if (!OSSL_PARAM_get_size_t(p.keylen, &keylen)) {
291
0
            ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER);
292
0
            return 0;
293
0
        }
294
44
        if (ctx->keylen != keylen) {
295
39
            ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
296
39
            return 0;
297
39
        }
298
44
    }
299
315
    return 1;
300
354
}
301
302
#define IMPLEMENT_cipher(mode, fname, UCMODE, flags, kbits, blkbits, ivbits)    \
303
    static OSSL_FUNC_cipher_get_params_fn aes_##kbits##_##fname##_get_params;   \
304
    static int aes_##kbits##_##fname##_get_params(OSSL_PARAM params[])          \
305
1.02k
    {                                                                           \
306
1.02k
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
1.02k
            flags, kbits, blkbits, ivbits);                                     \
308
1.02k
    }                                                                           \
cipher_aes_wrp.c:aes_256_wrap_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_192_wrap_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_128_wrap_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_256_wrappad_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_192_wrappad_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_128_wrappad_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_256_wrapinv_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_192_wrapinv_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_128_wrapinv_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_256_wrappadinv_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_192_wrappadinv_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
cipher_aes_wrp.c:aes_128_wrappadinv_get_params
Line
Count
Source
305
85
    {                                                                           \
306
85
        return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
307
85
            flags, kbits, blkbits, ivbits);                                     \
308
85
    }                                                                           \
309
    static OSSL_FUNC_cipher_newctx_fn aes_##kbits##fname##_newctx;              \
310
    static void *aes_##kbits##fname##_newctx(void *provctx)                     \
311
194
    {                                                                           \
312
194
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
194
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
194
    }                                                                           \
cipher_aes_wrp.c:aes_256wrap_newctx
Line
Count
Source
311
68
    {                                                                           \
312
68
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
68
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
68
    }                                                                           \
cipher_aes_wrp.c:aes_192wrap_newctx
Line
Count
Source
311
27
    {                                                                           \
312
27
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
27
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
27
    }                                                                           \
cipher_aes_wrp.c:aes_128wrap_newctx
Line
Count
Source
311
30
    {                                                                           \
312
30
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
30
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
30
    }                                                                           \
cipher_aes_wrp.c:aes_256wrappad_newctx
Line
Count
Source
311
18
    {                                                                           \
312
18
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
18
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
18
    }                                                                           \
cipher_aes_wrp.c:aes_192wrappad_newctx
Line
Count
Source
311
15
    {                                                                           \
312
15
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
15
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
15
    }                                                                           \
cipher_aes_wrp.c:aes_128wrappad_newctx
Line
Count
Source
311
17
    {                                                                           \
312
17
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
17
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
17
    }                                                                           \
cipher_aes_wrp.c:aes_256wrapinv_newctx
Line
Count
Source
311
4
    {                                                                           \
312
4
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
4
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
4
    }                                                                           \
cipher_aes_wrp.c:aes_192wrapinv_newctx
Line
Count
Source
311
2
    {                                                                           \
312
2
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
2
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
2
    }                                                                           \
cipher_aes_wrp.c:aes_128wrapinv_newctx
Line
Count
Source
311
3
    {                                                                           \
312
3
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
3
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
3
    }                                                                           \
cipher_aes_wrp.c:aes_256wrappadinv_newctx
Line
Count
Source
311
3
    {                                                                           \
312
3
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
3
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
3
    }                                                                           \
cipher_aes_wrp.c:aes_192wrappadinv_newctx
Line
Count
Source
311
4
    {                                                                           \
312
4
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
4
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
4
    }                                                                           \
cipher_aes_wrp.c:aes_128wrappadinv_newctx
Line
Count
Source
311
3
    {                                                                           \
312
3
        return aes_##mode##_newctx(provctx, kbits, blkbits, ivbits,             \
313
3
            EVP_CIPH_##UCMODE##_MODE, flags);                                   \
314
3
    }                                                                           \
315
    const OSSL_DISPATCH ossl_##aes##kbits##fname##_functions[] = {              \
316
        { OSSL_FUNC_CIPHER_NEWCTX,                                              \
317
            (void (*)(void))aes_##kbits##fname##_newctx },                      \
318
        { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))aes_##mode##_einit },  \
319
        { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))aes_##mode##_dinit },  \
320
        { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))aes_##mode##_cipher },       \
321
        { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))aes_##mode##_final },         \
322
        { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))aes_##mode##_freectx },     \
323
        { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void))aes_##mode##_dupctx },       \
324
        { OSSL_FUNC_CIPHER_GET_PARAMS,                                          \
325
            (void (*)(void))aes_##kbits##_##fname##_get_params },               \
326
        { OSSL_FUNC_CIPHER_GETTABLE_PARAMS,                                     \
327
            (void (*)(void))ossl_cipher_generic_gettable_params },              \
328
        { OSSL_FUNC_CIPHER_GET_CTX_PARAMS,                                      \
329
            (void (*)(void))ossl_cipher_generic_get_ctx_params },               \
330
        { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS,                                 \
331
            (void (*)(void))ossl_cipher_generic_gettable_ctx_params },          \
332
        { OSSL_FUNC_CIPHER_SET_CTX_PARAMS,                                      \
333
            (void (*)(void))aes_wrap_set_ctx_params },                          \
334
        { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS,                                 \
335
            (void (*)(void))aes_wrap_settable_ctx_params },                     \
336
        OSSL_DISPATCH_END                                                       \
337
    }
338
339
IMPLEMENT_cipher(wrap, wrap, WRAP, WRAP_FLAGS, 256, 64, AES_WRAP_NOPAD_IVLEN * 8);
340
IMPLEMENT_cipher(wrap, wrap, WRAP, WRAP_FLAGS, 192, 64, AES_WRAP_NOPAD_IVLEN * 8);
341
IMPLEMENT_cipher(wrap, wrap, WRAP, WRAP_FLAGS, 128, 64, AES_WRAP_NOPAD_IVLEN * 8);
342
IMPLEMENT_cipher(wrap, wrappad, WRAP, WRAP_FLAGS, 256, 64, AES_WRAP_PAD_IVLEN * 8);
343
IMPLEMENT_cipher(wrap, wrappad, WRAP, WRAP_FLAGS, 192, 64, AES_WRAP_PAD_IVLEN * 8);
344
IMPLEMENT_cipher(wrap, wrappad, WRAP, WRAP_FLAGS, 128, 64, AES_WRAP_PAD_IVLEN * 8);
345
346
IMPLEMENT_cipher(wrap, wrapinv, WRAP, WRAP_FLAGS_INV, 256, 64, AES_WRAP_NOPAD_IVLEN * 8);
347
IMPLEMENT_cipher(wrap, wrapinv, WRAP, WRAP_FLAGS_INV, 192, 64, AES_WRAP_NOPAD_IVLEN * 8);
348
IMPLEMENT_cipher(wrap, wrapinv, WRAP, WRAP_FLAGS_INV, 128, 64, AES_WRAP_NOPAD_IVLEN * 8);
349
IMPLEMENT_cipher(wrap, wrappadinv, WRAP, WRAP_FLAGS_INV, 256, 64, AES_WRAP_PAD_IVLEN * 8);
350
IMPLEMENT_cipher(wrap, wrappadinv, WRAP, WRAP_FLAGS_INV, 192, 64, AES_WRAP_PAD_IVLEN * 8);
351
IMPLEMENT_cipher(wrap, wrappadinv, WRAP, WRAP_FLAGS_INV, 128, 64, AES_WRAP_PAD_IVLEN * 8);