VirtualBox

source: vbox/trunk/include/iprt/crypto/cipher.h@ 74883

Last change on this file since 74883 was 74330, checked in by vboxsync, 6 years ago

scm fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/** @file
2 * IPRT - Crypto - Symmetric Ciphers.
3 */
4
5/*
6 * Copyright (C) 2018 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_crypto_cipher_h
27#define ___iprt_crypto_cipher_h
28
29#include <iprt/asn1.h>
30
31
32RT_C_DECLS_BEGIN
33
34struct RTCRX509SUBJECTPUBLICKEYINFO;
35
36/** @defgroup grp_rt_crcipher RTCrCipher - Symmetric Ciphers
37 * @ingroup grp_rt_crypto
38 * @{
39 */
40
41/**
42 * A symmetric cipher handle.
43 *
44 * @remarks In OpenSSL terms this corresponds to a EVP_CIPHER, while in Microsoft
45 * terms it is an algorithm handle. The latter is why a handle was
46 * choosen rather than constant descriptor structure pointer. */
47typedef struct RTCRCIPHERINT *RTCRCIPHER;
48/** Pointer to a symmetric cipher handle. */
49typedef RTCRCIPHER *PRTCRCIPHER;
50/** Nil symmetric cipher handle. */
51#define NIL_RTCRCIPHER ((RTCRCIPHER)0)
52
53/**
54 * Symmetric cipher types.
55 *
56 * @note Only add new types at the end, existing values must be stable.
57 */
58typedef enum RTCRCIPHERTYPE
59{
60 /** Invalid zero value. */
61 RTCRCIPHERTYPE_INVALID = 0,
62 /** XTS-AES-128 (NIST SP 800-38E). */
63 RTCRCIPHERTYPE_XTS_AES_128,
64 /** XTS-AES-256 (NIST SP 800-38E). */
65 RTCRCIPHERTYPE_XTS_AES_256,
66 /** End of valid symmetric cipher types. */
67 RTCRCIPHERTYPE_END,
68 /** Make sure the type is a 32-bit one. */
69 RTCRCIPHERTYPE_32BIT_HACK = 0x7fffffff
70} RTCRCIPHERTYPE;
71
72
73RTDECL(int) RTCrCipherOpenByType(PRTCRCIPHER phCipher, RTCRCIPHERTYPE enmType, uint32_t fFlags);
74RTDECL(uint32_t) RTCrCipherRetain(RTCRCIPHER hCipher);
75RTDECL(uint32_t) RTCrCipherRelease(RTCRCIPHER hCipher);
76RTDECL(uint32_t) RTCrCipherGetKeyLength(RTCRCIPHER hCipher);
77RTDECL(uint32_t) RTCrCipherGetInitializationVectorLength(RTCRCIPHER hCipher);
78RTDECL(uint32_t) RTCrCipherGetBlockSize(RTCRCIPHER hCipher);
79
80RTDECL(int) RTCrCipherEncrypt(RTCRCIPHER hCipher, void const *pvKey, size_t cbKey,
81 void const *pvInitVector, size_t cbInitVector,
82 void const *pvPlainText, size_t cbPlainText,
83 void *pvEncrypted, size_t cbEncrypted, size_t *pcbEncrypted);
84RTDECL(int) RTCrCipherDecrypt(RTCRCIPHER hCipher, void const *pvKey, size_t cbKey,
85 void const *pvInitVector, size_t cbInitVector,
86 void const *pvEncrypted, size_t cbEncrypted,
87 void *pvPlainText, size_t cbPlainText, size_t *pcbPlainText);
88
89/** @} */
90
91RT_C_DECLS_END
92
93#endif
94
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette