]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added httpcAddDefaultCert, and some header include changes to support this.
authoryellows8 <yellows8@users.noreply.github.com>
Tue, 12 Apr 2016 01:27:34 +0000 (21:27 -0400)
committeryellows8 <yellows8@users.noreply.github.com>
Tue, 12 Apr 2016 01:27:34 +0000 (21:27 -0400)
libctru/include/3ds.h
libctru/include/3ds/services/httpc.h
libctru/source/services/httpc.c

index 21840d51f4fe7d9e6c41e78fa08e4dc8d1c4e300..40c1025d16a9fbfc0ea5805ceaccf51c3979bdcf 100644 (file)
@@ -39,8 +39,8 @@ extern "C" {
 #include <3ds/services/gsplcd.h>
 #include <3ds/services/hid.h>
 #include <3ds/services/irrst.h>
-#include <3ds/services/httpc.h>
 #include <3ds/services/sslc.h>
+#include <3ds/services/httpc.h>
 #include <3ds/services/uds.h>
 #include <3ds/services/ndm.h>
 #include <3ds/services/ir.h>
index 21d9151f00a58f6d67a86381c4772f48253eefce..75866caa86b5f1a5e63df165e97e88a47288d985 100644 (file)
@@ -129,6 +129,13 @@ Result httpcGetResponseHeader(httpcContext *context, char* name, char* value, u3
  */
 Result httpcAddTrustedRootCA(httpcContext *context, u8 *cert, u32 certsize);
 
+/**
+ * @brief Adds a default RootCA cert to a HTTP context.
+ * @param context Context to use.
+ * @param certID ID of the cert to add, see sslc.h.
+ */
+Result httpcAddDefaultCert(httpcContext *context, SSLC_DefaultRootCert certID);
+
 /**
  * @brief Sets SSL options for the context.
  * The HTTPC SSL option bits are the same as those defined in sslc.h
index 5f7fb8292b51cb01e5fa72b0686fa7f7932f911b..296111b3d7d4b6fc2790c054e7d1aed823160d1f 100644 (file)
@@ -6,6 +6,7 @@
 #include <3ds/svc.h>
 #include <3ds/srv.h>
 #include <3ds/synchronization.h>
+#include <3ds/services/sslc.h>
 #include <3ds/services/httpc.h>
 #include <3ds/ipc.h>
 
@@ -418,6 +419,20 @@ Result httpcAddTrustedRootCA(httpcContext *context, u8 *cert, u32 certsize)
        return cmdbuf[1];
 }
 
+Result httpcAddDefaultCert(httpcContext *context, SSLC_DefaultRootCert certID)
+{
+       u32* cmdbuf=getThreadCommandBuffer();
+
+       cmdbuf[0]=IPC_MakeHeader(0x25,2,0); // 0x250080
+       cmdbuf[1]=context->httphandle;
+       cmdbuf[2]=certID;
+
+       Result ret=0;
+       if(R_FAILED(ret=svcSendSyncRequest(context->servhandle)))return ret;
+
+       return cmdbuf[1];
+}
+
 Result httpcSetSSLOpt(httpcContext *context, u32 options)
 {
        u32* cmdbuf=getThreadCommandBuffer();