summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2014-02-23 20:40:13 -0800
committerJay Sorg <jay.sorg@gmail.com>2014-02-23 20:40:13 -0800
commit25ad4d8a36b35277e7547484eb4ffe7fc4c1a698 (patch)
tree681f08aceb13144273344071ce0fcd232b248ff9
parent1f51f62df92fd8edce1a8c1b533150d2b058678a (diff)
downloadxrdp-proprietary-25ad4d8a36b35277e7547484eb4ffe7fc4c1a698.tar.gz
xrdp-proprietary-25ad4d8a36b35277e7547484eb4ffe7fc4c1a698.zip
common: add more fips ssl calls
-rw-r--r--common/ssl_calls.c66
-rw-r--r--common/ssl_calls.h10
2 files changed, 76 insertions, 0 deletions
diff --git a/common/ssl_calls.c b/common/ssl_calls.c
index 92569be5..a187edc9 100644
--- a/common/ssl_calls.c
+++ b/common/ssl_calls.c
@@ -158,6 +158,8 @@ ssl_md5_complete(void *md5_info, char *data)
MD5_Final((tui8 *)data, (MD5_CTX *)md5_info);
}
+/* FIPS stuff */
+
/*****************************************************************************/
void *APP_CC
ssl_des3_encrypt_info_create(const char *key, const char* ivec)
@@ -202,6 +204,7 @@ ssl_des3_info_delete(void *des3)
if (des3_ctx != 0)
{
EVP_CIPHER_CTX_cleanup(des3_ctx);
+ g_free(des3_ctx);
}
}
@@ -217,6 +220,7 @@ ssl_des3_encrypt(void *des3, int length, const char *in_data, char *out_data)
des3_ctx = (EVP_CIPHER_CTX *) des3;
lin_data = (const tui8 *) in_data;
lout_data = (tui8 *) out_data;
+ len = 0;
EVP_EncryptUpdate(des3_ctx, lout_data, &len, lin_data, length);
return 0;
}
@@ -233,11 +237,73 @@ ssl_des3_decrypt(void *des3, int length, const char *in_data, char *out_data)
des3_ctx = (EVP_CIPHER_CTX *) des3;
lin_data = (const tui8 *) in_data;
lout_data = (tui8 *) out_data;
+ len = 0;
EVP_DecryptUpdate(des3_ctx, lout_data, &len, lin_data, length);
return 0;
}
/*****************************************************************************/
+void * APP_CC
+ssl_hmac_info_create(void)
+{
+ HMAC_CTX *hmac_ctx;
+
+ hmac_ctx = (HMAC_CTX *) g_malloc(sizeof(HMAC_CTX), 1);
+ HMAC_CTX_init(hmac_ctx);
+ return hmac_ctx;
+}
+
+/*****************************************************************************/
+void APP_CC
+ssl_hmac_info_delete(void *hmac)
+{
+ HMAC_CTX *hmac_ctx;
+
+ hmac_ctx = (HMAC_CTX *) hmac;
+ if (hmac_ctx != 0)
+ {
+ HMAC_CTX_cleanup(hmac_ctx);
+ g_free(hmac_ctx);
+ }
+}
+
+/*****************************************************************************/
+void APP_CC
+ssl_hmac_sha1_init(void *hmac, const char *data, int len)
+{
+ HMAC_CTX *hmac_ctx;
+
+ hmac_ctx = (HMAC_CTX *) hmac;
+ HMAC_Init_ex(hmac_ctx, data, len, EVP_sha1(), NULL);
+}
+
+/*****************************************************************************/
+void APP_CC
+ssl_hmac_transform(void *hmac, const char *data, int len)
+{
+ HMAC_CTX *hmac_ctx;
+ const tui8 *ldata;
+
+ hmac_ctx = (HMAC_CTX *) hmac;
+ ldata = (const tui8*) data;
+ HMAC_Update(hmac_ctx, ldata, len);
+}
+
+/*****************************************************************************/
+void APP_CC
+ssl_hmac_complete(void *hmac, char *data, int len)
+{
+ HMAC_CTX *hmac_ctx;
+ tui8* ldata;
+ tui32 llen;
+
+ hmac_ctx = (HMAC_CTX *) hmac;
+ ldata = (tui8 *) data;
+ llen = len;
+ HMAC_Final(hmac_ctx, ldata, &llen);
+}
+
+/*****************************************************************************/
static void APP_CC
ssl_reverse_it(char *p, int len)
{
diff --git a/common/ssl_calls.h b/common/ssl_calls.h
index ab29675c..40acfb5b 100644
--- a/common/ssl_calls.h
+++ b/common/ssl_calls.h
@@ -63,6 +63,16 @@ int APP_CC
ssl_des3_encrypt(void *des3, int length, const char *in_data, char *out_data);
int APP_CC
ssl_des3_decrypt(void *des3, int length, const char *in_data, char *out_data);
+void * APP_CC
+ssl_hmac_info_create(void);
+void APP_CC
+ssl_hmac_info_delete(void *hmac);
+void APP_CC
+ssl_hmac_sha1_init(void *hmac, const char *data, int len);
+void APP_CC
+ssl_hmac_transform(void *hmac, const char *data, int len);
+void APP_CC
+ssl_hmac_complete(void *hmac, char *data, int len);
int APP_CC
ssl_mod_exp(char* out, int out_len, char* in, int in_len,
char* mod, int mod_len, char* exp, int exp_len);