Added httpcAddDefaultCert, and some header include changes to support this.

This commit is contained in:
yellows8 2016-04-11 21:27:34 -04:00
parent 47155d75b6
commit e61e45abdc
3 changed files with 23 additions and 1 deletions

View File

@ -39,8 +39,8 @@ extern "C" {
#include <3ds/services/gsplcd.h> #include <3ds/services/gsplcd.h>
#include <3ds/services/hid.h> #include <3ds/services/hid.h>
#include <3ds/services/irrst.h> #include <3ds/services/irrst.h>
#include <3ds/services/httpc.h>
#include <3ds/services/sslc.h> #include <3ds/services/sslc.h>
#include <3ds/services/httpc.h>
#include <3ds/services/uds.h> #include <3ds/services/uds.h>
#include <3ds/services/ndm.h> #include <3ds/services/ndm.h>
#include <3ds/services/ir.h> #include <3ds/services/ir.h>

View File

@ -129,6 +129,13 @@ Result httpcGetResponseHeader(httpcContext *context, char* name, char* value, u3
*/ */
Result httpcAddTrustedRootCA(httpcContext *context, u8 *cert, u32 certsize); 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. * @brief Sets SSL options for the context.
* The HTTPC SSL option bits are the same as those defined in sslc.h * The HTTPC SSL option bits are the same as those defined in sslc.h

View File

@ -6,6 +6,7 @@
#include <3ds/svc.h> #include <3ds/svc.h>
#include <3ds/srv.h> #include <3ds/srv.h>
#include <3ds/synchronization.h> #include <3ds/synchronization.h>
#include <3ds/services/sslc.h>
#include <3ds/services/httpc.h> #include <3ds/services/httpc.h>
#include <3ds/ipc.h> #include <3ds/ipc.h>
@ -418,6 +419,20 @@ Result httpcAddTrustedRootCA(httpcContext *context, u8 *cert, u32 certsize)
return cmdbuf[1]; 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) Result httpcSetSSLOpt(httpcContext *context, u32 options)
{ {
u32* cmdbuf=getThreadCommandBuffer(); u32* cmdbuf=getThreadCommandBuffer();