[crypto] rename rdpRsaKey to rdpPrivateKey
This commit is contained in:
parent
7728df6804
commit
af371bef6a
@ -29,12 +29,12 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct rdp_rsa_key rdpRsaKey;
|
||||
typedef struct rdp_private_key rdpPrivateKey;
|
||||
|
||||
FREERDP_API rdpRsaKey* freerdp_key_new(void);
|
||||
FREERDP_API rdpRsaKey* freerdp_key_new_from_file(const char* keyfile);
|
||||
FREERDP_API rdpRsaKey* freerdp_key_new_from_pem(const char* pem);
|
||||
FREERDP_API void freerdp_key_free(rdpRsaKey* key);
|
||||
FREERDP_API rdpPrivateKey* freerdp_key_new(void);
|
||||
FREERDP_API rdpPrivateKey* freerdp_key_new_from_file(const char* keyfile);
|
||||
FREERDP_API rdpPrivateKey* freerdp_key_new_from_pem(const char* pem);
|
||||
FREERDP_API void freerdp_key_free(rdpPrivateKey* key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1223,7 +1223,7 @@ struct rdp_settings
|
||||
ALIGN64 char* CertificateFile; /* 1410 */
|
||||
ALIGN64 char* PrivateKeyFile; /* 1411 */
|
||||
UINT64 padding1412[1413 - 1412]; /* 1412 */
|
||||
ALIGN64 rdpRsaKey* RdpServerRsaKey; /* 1413 */
|
||||
ALIGN64 rdpPrivateKey* RdpServerRsaKey; /* 1413 */
|
||||
ALIGN64 rdpCertificate* RdpServerCertificate; /* 1414 */
|
||||
ALIGN64 BOOL ExternalCertificateManagement; /* 1415 */
|
||||
ALIGN64 char* CertificateContent; /* 1416 */
|
||||
|
@ -1324,7 +1324,7 @@ BOOL freerdp_settings_set_pointer_len(rdpSettings* settings, size_t id, const vo
|
||||
WLog_ERR(TAG, "FreeRDP_RdpServerRsaKey::len must be 0 or 1");
|
||||
return FALSE;
|
||||
}
|
||||
settings->RdpServerRsaKey = (rdpRsaKey*)cnv.v;
|
||||
settings->RdpServerRsaKey = (rdpPrivateKey*)cnv.v;
|
||||
if (!settings->RdpServerRsaKey && (len > 0))
|
||||
{
|
||||
settings->RdpServerRsaKey = freerdp_key_new();
|
||||
|
@ -829,7 +829,7 @@ static BOOL rdp_update_client_random(rdpSettings* settings, const BYTE* crypt_ra
|
||||
const size_t length = 32;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
const rdpRsaKey* rsa = freerdp_settings_get_pointer(settings, FreeRDP_RdpServerRsaKey);
|
||||
const rdpPrivateKey* rsa = freerdp_settings_get_pointer(settings, FreeRDP_RdpServerRsaKey);
|
||||
WINPR_ASSERT(rsa);
|
||||
|
||||
const rdpCertInfo* cinfo = freerdp_key_get_info(rsa);
|
||||
|
@ -840,7 +840,7 @@ static BOOL freerdp_settings_int_buffer_copy(rdpSettings* _settings, const rdpSe
|
||||
|
||||
if (settings->RdpServerRsaKey)
|
||||
{
|
||||
rdpRsaKey* key = freerdp_key_clone(settings->RdpServerRsaKey);
|
||||
rdpPrivateKey* key = freerdp_key_clone(settings->RdpServerRsaKey);
|
||||
if (!key)
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_pointer_len(_settings, FreeRDP_RdpServerRsaKey, key, 1))
|
||||
|
@ -852,7 +852,7 @@ static BOOL test_pointer_array(void)
|
||||
sizeof(rdpMonitor) },
|
||||
{ TRUE, TRUE, FreeRDP_ClientTimeZone, -1, 1, sizeof(TIME_ZONE_INFORMATION) },
|
||||
{ FALSE, FALSE, FreeRDP_RdpServerCertificate, -1, 1, sizeof(rdpCertificate*) },
|
||||
//{ FALSE, FALSE, FreeRDP_RdpServerRsaKey, -1, 1, sizeof(rdpRsaKey*) },
|
||||
//{ FALSE, FALSE, FreeRDP_RdpServerRsaKey, -1, 1, sizeof(rdpPrivateKey*) },
|
||||
{ TRUE, TRUE, FreeRDP_RedirectionPassword, FreeRDP_RedirectionPasswordLength, 42,
|
||||
sizeof(char) },
|
||||
{ TRUE, TRUE, FreeRDP_RedirectionTsvUrl, FreeRDP_RedirectionTsvUrlLength, 42,
|
||||
|
@ -133,7 +133,7 @@ static SSIZE_T crypto_rsa_public(const BYTE* input, size_t length, const rdpCert
|
||||
sizeof(cert->exponent), output, output_length);
|
||||
}
|
||||
|
||||
static SSIZE_T crypto_rsa_private(const BYTE* input, size_t length, const rdpRsaKey* key,
|
||||
static SSIZE_T crypto_rsa_private(const BYTE* input, size_t length, const rdpPrivateKey* key,
|
||||
BYTE* output, size_t output_length)
|
||||
{
|
||||
WINPR_ASSERT(key);
|
||||
@ -158,13 +158,13 @@ SSIZE_T crypto_rsa_public_decrypt(const BYTE* input, size_t length, const rdpCer
|
||||
return crypto_rsa_public(input, length, cert, output, output_length);
|
||||
}
|
||||
|
||||
SSIZE_T crypto_rsa_private_encrypt(const BYTE* input, size_t length, const rdpRsaKey* key,
|
||||
SSIZE_T crypto_rsa_private_encrypt(const BYTE* input, size_t length, const rdpPrivateKey* key,
|
||||
BYTE* output, size_t output_length)
|
||||
{
|
||||
return crypto_rsa_private(input, length, key, output, output_length);
|
||||
}
|
||||
|
||||
SSIZE_T crypto_rsa_private_decrypt(const BYTE* input, size_t length, const rdpRsaKey* key,
|
||||
SSIZE_T crypto_rsa_private_decrypt(const BYTE* input, size_t length, const rdpPrivateKey* key,
|
||||
BYTE* output, size_t output_length)
|
||||
{
|
||||
return crypto_rsa_private(input, length, key, output, output_length);
|
||||
|
@ -40,10 +40,10 @@ extern "C"
|
||||
const rdpCertInfo* cert, BYTE* output,
|
||||
size_t output_length);
|
||||
FREERDP_LOCAL SSIZE_T crypto_rsa_private_encrypt(const BYTE* input, size_t length,
|
||||
const rdpRsaKey* key, BYTE* output,
|
||||
const rdpPrivateKey* key, BYTE* output,
|
||||
size_t output_length);
|
||||
FREERDP_LOCAL SSIZE_T crypto_rsa_private_decrypt(const BYTE* input, size_t length,
|
||||
const rdpRsaKey* key, BYTE* output,
|
||||
const rdpPrivateKey* key, BYTE* output,
|
||||
size_t output_length);
|
||||
|
||||
FREERDP_LOCAL void crypto_reverse(BYTE* data, size_t length);
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
#define TAG FREERDP_TAG("crypto")
|
||||
|
||||
struct rdp_rsa_key
|
||||
struct rdp_private_key
|
||||
{
|
||||
EVP_PKEY* evp;
|
||||
BOOL isRSA;
|
||||
@ -77,11 +77,11 @@ static BYTE tssk_privateExponent[] = {
|
||||
0x35, 0x07, 0x79, 0x17, 0x0b, 0x51, 0x9b, 0xb3, 0xc7, 0x10, 0x01, 0x13, 0xe7, 0x3f, 0xf3, 0x5f
|
||||
};
|
||||
|
||||
static const rdpRsaKey tssk = { .PrivateExponent = tssk_privateExponent,
|
||||
.PrivateExponentLength = sizeof(tssk_privateExponent),
|
||||
.cert = { .Modulus = tssk_modulus,
|
||||
.ModulusLength = sizeof(tssk_modulus) } };
|
||||
const rdpRsaKey* priv_key_tssk = &tssk;
|
||||
static const rdpPrivateKey tssk = { .PrivateExponent = tssk_privateExponent,
|
||||
.PrivateExponentLength = sizeof(tssk_privateExponent),
|
||||
.cert = { .Modulus = tssk_modulus,
|
||||
.ModulusLength = sizeof(tssk_modulus) } };
|
||||
const rdpPrivateKey* priv_key_tssk = &tssk;
|
||||
|
||||
static RSA* evp_pkey_to_rsa(const EVP_PKEY* evp)
|
||||
{
|
||||
@ -129,7 +129,7 @@ static EVP_PKEY* evp_pkey_utils_from_pem(const char* data, size_t len, BOOL from
|
||||
return evp;
|
||||
}
|
||||
|
||||
static BOOL key_read_private(rdpRsaKey* key)
|
||||
static BOOL key_read_private(rdpPrivateKey* key)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
|
||||
@ -181,9 +181,9 @@ fail:
|
||||
return rc;
|
||||
}
|
||||
|
||||
rdpRsaKey* freerdp_key_new_from_pem(const char* pem)
|
||||
rdpPrivateKey* freerdp_key_new_from_pem(const char* pem)
|
||||
{
|
||||
rdpRsaKey* key = freerdp_key_new();
|
||||
rdpPrivateKey* key = freerdp_key_new();
|
||||
if (!key || !pem)
|
||||
goto fail;
|
||||
key->evp = evp_pkey_utils_from_pem(pem, strlen(pem), FALSE);
|
||||
@ -197,10 +197,10 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rdpRsaKey* freerdp_key_new_from_file(const char* keyfile)
|
||||
rdpPrivateKey* freerdp_key_new_from_file(const char* keyfile)
|
||||
{
|
||||
|
||||
rdpRsaKey* key = freerdp_key_new();
|
||||
rdpPrivateKey* key = freerdp_key_new();
|
||||
if (!key || !keyfile)
|
||||
goto fail;
|
||||
|
||||
@ -215,17 +215,17 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rdpRsaKey* freerdp_key_new(void)
|
||||
rdpPrivateKey* freerdp_key_new(void)
|
||||
{
|
||||
return calloc(1, sizeof(rdpRsaKey));
|
||||
return calloc(1, sizeof(rdpPrivateKey));
|
||||
}
|
||||
|
||||
rdpRsaKey* freerdp_key_clone(const rdpRsaKey* key)
|
||||
rdpPrivateKey* freerdp_key_clone(const rdpPrivateKey* key)
|
||||
{
|
||||
if (!key)
|
||||
return NULL;
|
||||
|
||||
rdpRsaKey* _key = (rdpRsaKey*)calloc(1, sizeof(rdpRsaKey));
|
||||
rdpPrivateKey* _key = (rdpPrivateKey*)calloc(1, sizeof(rdpPrivateKey));
|
||||
|
||||
if (!_key)
|
||||
return NULL;
|
||||
@ -255,7 +255,7 @@ out_fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void freerdp_key_free(rdpRsaKey* key)
|
||||
void freerdp_key_free(rdpPrivateKey* key)
|
||||
{
|
||||
if (!key)
|
||||
return;
|
||||
@ -268,7 +268,7 @@ void freerdp_key_free(rdpRsaKey* key)
|
||||
free(key);
|
||||
}
|
||||
|
||||
const rdpCertInfo* freerdp_key_get_info(const rdpRsaKey* key)
|
||||
const rdpCertInfo* freerdp_key_get_info(const rdpPrivateKey* key)
|
||||
{
|
||||
WINPR_ASSERT(key);
|
||||
if (!key->isRSA)
|
||||
@ -276,7 +276,7 @@ const rdpCertInfo* freerdp_key_get_info(const rdpRsaKey* key)
|
||||
return &key->cert;
|
||||
}
|
||||
|
||||
const BYTE* freerdp_key_get_exponent(const rdpRsaKey* key, size_t* plength)
|
||||
const BYTE* freerdp_key_get_exponent(const rdpPrivateKey* key, size_t* plength)
|
||||
{
|
||||
WINPR_ASSERT(key);
|
||||
if (!key->isRSA)
|
||||
@ -291,7 +291,7 @@ const BYTE* freerdp_key_get_exponent(const rdpRsaKey* key, size_t* plength)
|
||||
return key->PrivateExponent;
|
||||
}
|
||||
|
||||
RSA* freerdp_key_get_RSA(const rdpRsaKey* key)
|
||||
RSA* freerdp_key_get_RSA(const rdpPrivateKey* key)
|
||||
{
|
||||
WINPR_ASSERT(key);
|
||||
if (!key->isRSA)
|
||||
|
@ -30,14 +30,14 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
FREERDP_LOCAL rdpRsaKey* freerdp_key_clone(const rdpRsaKey* key);
|
||||
FREERDP_LOCAL rdpPrivateKey* freerdp_key_clone(const rdpPrivateKey* key);
|
||||
|
||||
FREERDP_LOCAL const rdpCertInfo* freerdp_key_get_info(const rdpRsaKey* key);
|
||||
FREERDP_LOCAL const BYTE* freerdp_key_get_exponent(const rdpRsaKey* key, size_t* plength);
|
||||
FREERDP_LOCAL const rdpCertInfo* freerdp_key_get_info(const rdpPrivateKey* key);
|
||||
FREERDP_LOCAL const BYTE* freerdp_key_get_exponent(const rdpPrivateKey* key, size_t* plength);
|
||||
|
||||
FREERDP_LOCAL RSA* freerdp_key_get_RSA(const rdpRsaKey* key);
|
||||
FREERDP_LOCAL RSA* freerdp_key_get_RSA(const rdpPrivateKey* key);
|
||||
|
||||
FREERDP_LOCAL extern const rdpRsaKey* priv_key_tssk;
|
||||
FREERDP_LOCAL extern const rdpPrivateKey* priv_key_tssk;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ struct vgids_context
|
||||
vgidsSE currentSE;
|
||||
|
||||
rdpCertificate* certificate;
|
||||
rdpRsaKey* privateKey;
|
||||
rdpPrivateKey* privateKey;
|
||||
|
||||
wArrayList* files;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user