aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/x509/common.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2008-10-12 21:40:47 +0000
committerChristian Grothoff <christian@grothoff.org>2008-10-12 21:40:47 +0000
commitfd769761a5236eeead5f7895aa5209b1ffad7028 (patch)
tree81e662c3745c806d3bba1e7418bd1abba58a7d93 /src/daemon/https/x509/common.c
parent19db7f74f4f6e37dc645f8363fd1259422a01462 (diff)
downloadlibmicrohttpd-fd769761a5236eeead5f7895aa5209b1ffad7028.tar.gz
libmicrohttpd-fd769761a5236eeead5f7895aa5209b1ffad7028.zip
removing dead extension code
Diffstat (limited to 'src/daemon/https/x509/common.c')
-rw-r--r--src/daemon/https/x509/common.c82
1 files changed, 6 insertions, 76 deletions
diff --git a/src/daemon/https/x509/common.c b/src/daemon/https/x509/common.c
index 43da45c9..6e7e0853 100644
--- a/src/daemon/https/x509/common.c
+++ b/src/daemon/https/x509/common.c
@@ -381,7 +381,7 @@ MHD__gnutls_x509_oid_data2string (const char *oid,
381 } 381 }
382 else 382 else
383 { 383 {
384 result = MHD__gnutls_x509_data2hex (str, len, res, res_size); 384 result = MHD__gnutls_x509_data2hex ((const unsigned char*) str, len, (unsigned char*) res, res_size);
385 if (result < 0) 385 if (result < 0)
386 { 386 {
387 MHD_gnutls_assert (); 387 MHD_gnutls_assert ();
@@ -425,8 +425,8 @@ MHD__gnutls_x509_data2hex (const opaque * data,
425 425
426 if (out) 426 if (out)
427 { 427 {
428 strcpy (out, "#"); 428 strcpy ((char*) out, "#");
429 strcat (out, res); 429 strcat ((char*) out, res);
430 } 430 }
431 431
432 return 0; 432 return 0;
@@ -521,7 +521,7 @@ mktime_utc (const struct fake_tm *tm)
521 * month|day|hour|minute|sec* (2 chars each) 521 * month|day|hour|minute|sec* (2 chars each)
522 * and year is given. Returns a time_t date. 522 * and year is given. Returns a time_t date.
523 */ 523 */
524time_t 524static time_t
525MHD__gnutls_x509_time2gtime (const char *ttime, int year) 525MHD__gnutls_x509_time2gtime (const char *ttime, int year)
526{ 526{
527 char xx[3]; 527 char xx[3];
@@ -588,7 +588,7 @@ MHD__gnutls_x509_time2gtime (const char *ttime, int year)
588 * 588 *
589 * (seconds are optional) 589 * (seconds are optional)
590 */ 590 */
591time_t 591static time_t
592MHD__gnutls_x509_utcTime2gtime (const char *ttime) 592MHD__gnutls_x509_utcTime2gtime (const char *ttime)
593{ 593{
594 char xx[3]; 594 char xx[3];
@@ -614,44 +614,11 @@ MHD__gnutls_x509_utcTime2gtime (const char *ttime)
614 return MHD__gnutls_x509_time2gtime (ttime, year); 614 return MHD__gnutls_x509_time2gtime (ttime, year);
615} 615}
616 616
617/* returns a time value that contains the given time.
618 * The given time is expressed as:
619 * YEAR(2)|MONTH(2)|DAY(2)|HOUR(2)|MIN(2)|SEC(2)
620 */
621int
622MHD__gnutls_x509_gtime2utcTime (time_t gtime, char *str_time, int str_time_size)
623{
624 size_t ret;
625
626#ifdef HAVE_GMTIME_R
627 struct tm _tm;
628
629 gmtime_r (&gtime, &_tm);
630
631 ret = strftime (str_time, str_time_size, "%y%m%d%H%M%SZ", &_tm);
632#else
633 struct tm *_tm;
634
635 _tm = gmtime (&gtime);
636
637 ret = strftime (str_time, str_time_size, "%y%m%d%H%M%SZ", _tm);
638#endif
639
640 if (!ret)
641 {
642 MHD_gnutls_assert ();
643 return GNUTLS_E_SHORT_MEMORY_BUFFER;
644 }
645
646 return 0;
647
648}
649
650/* returns a time_t value that contains the given time. 617/* returns a time_t value that contains the given time.
651 * The given time is expressed as: 618 * The given time is expressed as:
652 * YEAR(4)|MONTH(2)|DAY(2)|HOUR(2)|MIN(2)|SEC(2)* 619 * YEAR(4)|MONTH(2)|DAY(2)|HOUR(2)|MIN(2)|SEC(2)*
653 */ 620 */
654time_t 621static time_t
655MHD__gnutls_x509_generalTime2gtime (const char *ttime) 622MHD__gnutls_x509_generalTime2gtime (const char *ttime)
656{ 623{
657 char xx[5]; 624 char xx[5];
@@ -735,43 +702,6 @@ MHD__gnutls_x509_get_time (ASN1_TYPE c2, const char *when)
735 return c_time; 702 return c_time;
736} 703}
737 704
738/* Sets the time in time_t in the ASN1_TYPE given. Where should
739 * be something like "tbsCertList.thisUpdate".
740 */
741int
742MHD__gnutls_x509_set_time (ASN1_TYPE c2, const char *where, time_t tim)
743{
744 char str_time[MAX_TIME];
745 char name[128];
746 int result, len;
747
748 MHD_gtls_str_cpy (name, sizeof (name), where);
749
750 if ((result = MHD__asn1_write_value (c2, name, "utcTime", 1)) < 0)
751 {
752 MHD_gnutls_assert ();
753 return MHD_gtls_asn2err (result);
754 }
755
756 result = MHD__gnutls_x509_gtime2utcTime (tim, str_time, sizeof (str_time));
757 if (result < 0)
758 {
759 MHD_gnutls_assert ();
760 return result;
761 }
762
763 MHD_gtls_str_cat (name, sizeof (name), ".utcTime");
764
765 len = strlen (str_time);
766 result = MHD__asn1_write_value (c2, name, str_time, len);
767 if (result != ASN1_SUCCESS)
768 {
769 MHD_gnutls_assert ();
770 return MHD_gtls_asn2err (result);
771 }
772
773 return 0;
774}
775 705
776MHD_gnutls_x509_subject_alt_name_t 706MHD_gnutls_x509_subject_alt_name_t
777MHD__gnutls_x509_san_find_type (char *str_type) 707MHD__gnutls_x509_san_find_type (char *str_type)