aes_wrap.c 932 字节
Newer Older
1
/*
R
Rich Salz 已提交
2
 * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
D
Dr. Stephen Henson 已提交
3
 *
R
Rich Salz 已提交
4 5 6 7
 * Licensed under the OpenSSL license (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
D
Dr. Stephen Henson 已提交
8 9
 */

10
#include "internal/cryptlib.h"
D
Dr. Stephen Henson 已提交
11
#include <openssl/aes.h>
12
#include <openssl/modes.h>
13

D
Dr. Stephen Henson 已提交
14
int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
15 16 17 18 19
                 unsigned char *out,
                 const unsigned char *in, unsigned int inlen)
{
    return CRYPTO_128_wrap(key, iv, out, in, inlen, (block128_f) AES_encrypt);
}
D
Dr. Stephen Henson 已提交
20 21

int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
22 23 24 25 26 27
                   unsigned char *out,
                   const unsigned char *in, unsigned int inlen)
{
    return CRYPTO_128_unwrap(key, iv, out, in, inlen,
                             (block128_f) AES_decrypt);
}