aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/tls/gnutls_pk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/tls/gnutls_pk.c')
-rw-r--r--src/daemon/https/tls/gnutls_pk.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/daemon/https/tls/gnutls_pk.c b/src/daemon/https/tls/gnutls_pk.c
index c4ec508a..7e170a32 100644
--- a/src/daemon/https/tls/gnutls_pk.c
+++ b/src/daemon/https/tls/gnutls_pk.c
@@ -41,13 +41,13 @@
41#include "mpi.h" 41#include "mpi.h"
42 42
43static int MHD__gnutls_pk_encrypt (int algo, mpi_t * resarr, mpi_t data, 43static int MHD__gnutls_pk_encrypt (int algo, mpi_t * resarr, mpi_t data,
44 mpi_t * pkey, int pkey_len); 44 mpi_t * pkey, int pkey_len);
45static int MHD__gnutls_pk_sign (int algo, mpi_t * data, mpi_t hash, 45static int MHD__gnutls_pk_sign (int algo, mpi_t * data, mpi_t hash,
46 mpi_t * pkey, int); 46 mpi_t * pkey, int);
47static int MHD__gnutls_pk_verify (int algo, mpi_t hash, mpi_t * data, 47static int MHD__gnutls_pk_verify (int algo, mpi_t hash, mpi_t * data,
48 mpi_t * pkey, int); 48 mpi_t * pkey, int);
49static int MHD__gnutls_pk_decrypt (int algo, mpi_t * resarr, mpi_t data, 49static int MHD__gnutls_pk_decrypt (int algo, mpi_t * resarr, mpi_t data,
50 mpi_t * pkey, int); 50 mpi_t * pkey, int);
51 51
52 52
53/* Do PKCS-1 RSA encryption. 53/* Do PKCS-1 RSA encryption.
@@ -104,7 +104,7 @@ MHD_gtls_pkcs1_rsa_encrypt (MHD_gnutls_datum_t * ciphertext,
104 return GNUTLS_E_INTERNAL_ERROR; 104 return GNUTLS_E_INTERNAL_ERROR;
105 } 105 }
106 106
107 if (MHD_gc_pseudo_random ((char*)ps, psize) != GC_OK) 107 if (MHD_gc_pseudo_random ((char *) ps, psize) != GC_OK)
108 { 108 {
109 MHD_gnutls_assert (); 109 MHD_gnutls_assert ();
110 MHD_gnutls_afree (edata); 110 MHD_gnutls_afree (edata);
@@ -113,7 +113,7 @@ MHD_gtls_pkcs1_rsa_encrypt (MHD_gnutls_datum_t * ciphertext,
113 for (i = 0; i < psize; i++) 113 for (i = 0; i < psize; i++)
114 while (ps[i] == 0) 114 while (ps[i] == 0)
115 { 115 {
116 if (MHD_gc_pseudo_random ((char*) &ps[i], 1) != GC_OK) 116 if (MHD_gc_pseudo_random ((char *) &ps[i], 1) != GC_OK)
117 { 117 {
118 MHD_gnutls_assert (); 118 MHD_gnutls_assert ();
119 MHD_gnutls_afree (edata); 119 MHD_gnutls_afree (edata);
@@ -391,8 +391,8 @@ encode_ber_rs (MHD_gnutls_datum_t * sig_value, mpi_t r, mpi_t s)
391 391
392 if ((result = 392 if ((result =
393 MHD__asn1_create_element (MHD__gnutls_getMHD__gnutls_asn (), 393 MHD__asn1_create_element (MHD__gnutls_getMHD__gnutls_asn (),
394 "GNUTLS.DSASignatureValue", 394 "GNUTLS.DSASignatureValue",
395 &sig)) != ASN1_SUCCESS) 395 &sig)) != ASN1_SUCCESS)
396 { 396 {
397 MHD_gnutls_assert (); 397 MHD_gnutls_assert ();
398 return MHD_gtls_asn2err (result); 398 return MHD_gtls_asn2err (result);
@@ -489,14 +489,15 @@ decode_ber_rs (const MHD_gnutls_datum_t * sig_value, mpi_t * r, mpi_t * s)
489 489
490 if ((result = 490 if ((result =
491 MHD__asn1_create_element (MHD__gnutls_getMHD__gnutls_asn (), 491 MHD__asn1_create_element (MHD__gnutls_getMHD__gnutls_asn (),
492 "GNUTLS.DSASignatureValue", 492 "GNUTLS.DSASignatureValue",
493 &sig)) != ASN1_SUCCESS) 493 &sig)) != ASN1_SUCCESS)
494 { 494 {
495 MHD_gnutls_assert (); 495 MHD_gnutls_assert ();
496 return MHD_gtls_asn2err (result); 496 return MHD_gtls_asn2err (result);
497 } 497 }
498 498
499 result = MHD__asn1_der_decoding (&sig, sig_value->data, sig_value->size, NULL); 499 result =
500 MHD__asn1_der_decoding (&sig, sig_value->data, sig_value->size, NULL);
500 if (result != ASN1_SUCCESS) 501 if (result != ASN1_SUCCESS)
501 { 502 {
502 MHD_gnutls_assert (); 503 MHD_gnutls_assert ();
@@ -585,7 +586,7 @@ MHD_gtls_dsa_verify (const MHD_gnutls_datum_t * vdata,
585 */ 586 */
586static int 587static int
587MHD__gnutls_pk_encrypt (int algo, mpi_t * resarr, mpi_t data, 588MHD__gnutls_pk_encrypt (int algo, mpi_t * resarr, mpi_t data,
588 mpi_t * pkey, int pkey_len) 589 mpi_t * pkey, int pkey_len)
589{ 590{
590 gcry_sexp_t s_ciph, s_data, s_pkey; 591 gcry_sexp_t s_ciph, s_data, s_pkey;
591 int rc = -1; 592 int rc = -1;
@@ -657,7 +658,7 @@ MHD__gnutls_pk_encrypt (int algo, mpi_t * resarr, mpi_t data,
657 658
658static int 659static int
659MHD__gnutls_pk_decrypt (int algo, mpi_t * resarr, mpi_t data, mpi_t * pkey, 660MHD__gnutls_pk_decrypt (int algo, mpi_t * resarr, mpi_t data, mpi_t * pkey,
660 int pkey_len) 661 int pkey_len)
661{ 662{
662 gcry_sexp_t s_plain, s_data, s_pkey; 663 gcry_sexp_t s_plain, s_data, s_pkey;
663 int rc = -1; 664 int rc = -1;
@@ -724,7 +725,7 @@ MHD__gnutls_pk_decrypt (int algo, mpi_t * resarr, mpi_t data, mpi_t * pkey,
724 */ 725 */
725static int 726static int
726MHD__gnutls_pk_sign (int algo, mpi_t * data, mpi_t hash, mpi_t * pkey, 727MHD__gnutls_pk_sign (int algo, mpi_t * data, mpi_t hash, mpi_t * pkey,
727 int pkey_len) 728 int pkey_len)
728{ 729{
729 gcry_sexp_t s_hash, s_key, s_sig; 730 gcry_sexp_t s_hash, s_key, s_sig;
730 int rc = -1; 731 int rc = -1;
@@ -834,7 +835,7 @@ MHD__gnutls_pk_sign (int algo, mpi_t * data, mpi_t hash, mpi_t * pkey,
834 835
835static int 836static int
836MHD__gnutls_pk_verify (int algo, mpi_t hash, mpi_t * data, 837MHD__gnutls_pk_verify (int algo, mpi_t hash, mpi_t * data,
837 mpi_t * pkey, int pkey_len) 838 mpi_t * pkey, int pkey_len)
838{ 839{
839 gcry_sexp_t s_sig, s_hash, s_pkey; 840 gcry_sexp_t s_sig, s_hash, s_pkey;
840 int rc = -1; 841 int rc = -1;