NetSurf
Data Structures | Macros | Enumerations | Functions
sslcert.c File Reference

Implementation of Amiga certificate viewing using core windows. More...

#include <stdint.h>
#include <stdlib.h>
#include <proto/intuition.h>
#include <classes/window.h>
#include <gadgets/button.h>
#include <gadgets/layout.h>
#include <gadgets/scroller.h>
#include <gadgets/space.h>
#include <images/label.h>
#include <intuition/icclass.h>
#include <reaction/reaction_macros.h>
#include "utils/log.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "desktop/sslcert_viewer.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "amiga/corewindow.h"
#include "amiga/libs.h"
#include "amiga/sslcert.h"
#include "amiga/utf8.h"
Include dependency graph for sslcert.c:

Go to the source code of this file.

Data Structures

struct  ami_crtvrfy_window
 

Macros

#define GID_SSLCERT_SIZE   GID_SSLCERT_LAST - GID_CW_LAST
 

Enumerations

enum  { GID_SSLCERT_ACCEPT = GID_CW_LAST, GID_SSLCERT_REJECT, GID_SSLCERT_LAST }
 Amiga certificate viewing window context. More...
 

Functions

static nserror ami_crtvrfy_destroy (struct ami_crtvrfy_window *crtvrfy_win)
 destroy a previously created certificate view More...
 
static void ami_crtvrfy_accept (struct ami_corewindow *ami_cw)
 
static void ami_crtvrfy_reject (struct ami_corewindow *ami_cw)
 
static BOOL ami_crtvrfy_event (struct ami_corewindow *ami_cw, ULONG result)
 callback for unknown events on Amiga core window eg. More...
 
static nserror ami_crtvrfy_mouse (struct ami_corewindow *ami_cw, browser_mouse_state mouse_state, int x, int y)
 callback for mouse action for certificate verify on core window More...
 
static nserror ami_crtvrfy_key (struct ami_corewindow *ami_cw, uint32_t nskey)
 callback for keypress for certificate verify on core window More...
 
static nserror ami_crtvrfy_draw (struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
 callback on draw event for certificate verify on core window More...
 
static nserror ami_crtvrfy_create_window (struct ami_crtvrfy_window *crtvrfy_win)
 
nserror ami_cert_verify (struct nsurl *url, const struct cert_chain *chain, nserror(*cb)(bool proceed, void *pw), void *cbpw)
 Prompt the user to verify a certificate with issues. More...
 

Detailed Description

Implementation of Amiga certificate viewing using core windows.

Definition in file sslcert.c.

Macro Definition Documentation

◆ GID_SSLCERT_SIZE

#define GID_SSLCERT_SIZE   GID_SSLCERT_LAST - GID_CW_LAST

Definition at line 61 of file sslcert.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Amiga certificate viewing window context.

Enumerator
GID_SSLCERT_ACCEPT 
GID_SSLCERT_REJECT 
GID_SSLCERT_LAST 

Definition at line 55 of file sslcert.c.

Function Documentation

◆ ami_cert_verify()

nserror ami_cert_verify ( struct nsurl url,
const struct cert_chain chain,
nserror(*)(bool proceed, void *pw)  cb,
void *  cbpw 
)

Prompt the user to verify a certificate with issues.

Parameters
urlThe URL being verified.
certsThe certificate to be verified
numThe number of certificates to be verified.
cbCallback upon user decision.
cbpwContext pointer passed to cb
Returns
NSERROR_OK or error code if prompt creation failed.

Definition at line 300 of file sslcert.c.

References ami_corewindow_init(), ami_crtvrfy_create_window(), ami_crtvrfy_draw(), ami_crtvrfy_event(), ami_crtvrfy_key(), ami_crtvrfy_mouse(), ami_crtvrfy_reject(), ami_utf8_easy(), ami_utf8_free(), ami_corewindow::cb_table, ami_corewindow::close, ami_crtvrfy_window::core, ami_corewindow::draw, ami_corewindow::event, GID_CW_WIN, ami_corewindow::key, messages_get(), ami_corewindow::mouse, NSERROR_NOMEM, NSERROR_OK, NSLOG, ami_corewindow::objects, ami_crtvrfy_window::ssl_data, ami_crtvrfy_window::sslaccept, sslcert_viewer_create_session_data(), sslcert_viewer_init(), ami_crtvrfy_window::sslerr, ami_crtvrfy_window::sslreject, and ami_corewindow::wintitle.

Here is the call graph for this function:

◆ ami_crtvrfy_accept()

static void ami_crtvrfy_accept ( struct ami_corewindow ami_cw)
static

Definition at line 97 of file sslcert.c.

References ami_crtvrfy_destroy(), ami_crtvrfy_window::ssl_data, and sslcert_viewer_accept().

Referenced by ami_crtvrfy_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_crtvrfy_create_window()

static nserror ami_crtvrfy_create_window ( struct ami_crtvrfy_window crtvrfy_win)
static

Definition at line 217 of file sslcert.c.

References ami_gui_get_screen(), ami_gui_get_screen_title(), ami_gui_get_shared_msgport(), ButtonObj, BVS_DISPLAY, ami_crtvrfy_window::core, GID_CW_DRAW, GID_CW_HSCROLL, GID_CW_HSCROLLLAYOUT, GID_CW_MAIN, GID_CW_VSCROLL, GID_CW_VSCROLLLAYOUT, GID_CW_WIN, GID_SSLCERT_ACCEPT, GID_SSLCERT_REJECT, IDCMP_EXTENDEDMOUSE, ami_corewindow::idcmp_hook, LabelObj, LayoutHObj, LayoutVObj, NSERROR_NOMEM, NSERROR_OK, nsoption_bool, ami_corewindow::objects, scrn, ScrollerObj, SpaceObj, WindowObj, and ami_corewindow::wintitle.

Referenced by ami_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_crtvrfy_destroy()

static nserror ami_crtvrfy_destroy ( struct ami_crtvrfy_window crtvrfy_win)
static

destroy a previously created certificate view

Definition at line 82 of file sslcert.c.

References ami_corewindow_fini(), ami_utf8_free(), ami_crtvrfy_window::core, NSERROR_OK, ami_crtvrfy_window::ssl_data, ami_crtvrfy_window::sslaccept, sslcert_viewer_fini(), ami_crtvrfy_window::sslerr, and ami_crtvrfy_window::sslreject.

Referenced by ami_crtvrfy_accept(), and ami_crtvrfy_reject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_crtvrfy_draw()

static nserror ami_crtvrfy_draw ( struct ami_corewindow ami_cw,
int  x,
int  y,
struct rect r,
struct redraw_context ctx 
)
static

callback on draw event for certificate verify on core window

Parameters
ami_cwThe Amiga core window structure.
xthe x coordinate to draw
ythe y coordinate to draw
rThe rectangle of the window that needs updating.
ctxThe drawing context
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 204 of file sslcert.c.

References NSERROR_OK, ami_crtvrfy_window::ssl_data, and sslcert_viewer_redraw().

Referenced by ami_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_crtvrfy_event()

static BOOL ami_crtvrfy_event ( struct ami_corewindow ami_cw,
ULONG  result 
)
static

callback for unknown events on Amiga core window eg.

buttons in the ssl cert window (result & WMHI_CLASSMASK) gives the class of event (eg. WMHI_GADGETUP) (result & WMHI_GADGETMASK) gives the gadget ID (eg. GID_SSLCERT_ACCEPT)

Parameters
ami_cwThe Amiga core window structure.
resultevent as returned by RA_HandleInput()
Returns
TRUE if window closed during event processing

Definition at line 131 of file sslcert.c.

References ami_crtvrfy_accept(), ami_crtvrfy_reject(), GID_SSLCERT_ACCEPT, and GID_SSLCERT_REJECT.

Referenced by ami_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_crtvrfy_key()

static nserror ami_crtvrfy_key ( struct ami_corewindow ami_cw,
uint32_t  nskey 
)
static

callback for keypress for certificate verify on core window

Parameters
ami_cwThe Amiga core window structure.
nskeyThe netsurf key code
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 180 of file sslcert.c.

References NSERROR_NOT_IMPLEMENTED, NSERROR_OK, ami_crtvrfy_window::ssl_data, and sslcert_viewer_keypress().

Referenced by ami_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_crtvrfy_mouse()

static nserror ami_crtvrfy_mouse ( struct ami_corewindow ami_cw,
browser_mouse_state  mouse_state,
int  x,
int  y 
)
static

callback for mouse action for certificate verify on core window

Parameters
ami_cwThe Amiga core window structure.
mouse_statenetsurf mouse state on event
xlocation of event
ylocation of event
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 159 of file sslcert.c.

References NSERROR_OK, ami_crtvrfy_window::ssl_data, and sslcert_viewer_mouse_action().

Referenced by ami_cert_verify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_crtvrfy_reject()

static void ami_crtvrfy_reject ( struct ami_corewindow ami_cw)
static

Definition at line 109 of file sslcert.c.

References ami_crtvrfy_destroy(), ami_crtvrfy_window::ssl_data, and sslcert_viewer_reject().

Referenced by ami_cert_verify(), and ami_crtvrfy_event().

Here is the call graph for this function:
Here is the caller graph for this function: