LibreOffice Module onlineupdate (master) 1
Macros | Functions
mar.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <onlineupdate/mar.h>
#include <onlineupdate/mar_cmdline.h>
#include <unistd.h>
#include <errno.h>
#include "cert.h"
#include "pk11pub.h"
Include dependency graph for mar.c:

Go to the source code of this file.

Macros

#define MAR_CHANNEL_ID
 

Functions

int NSSInitCryptoContext (const char *NSSConfigDir)
 Initializes the NSS context. More...
 
int mar_repackage_and_sign (const char *NSSConfigDir, const char *const *certNames, uint32_t certCount, const char *src, const char *dest)
 Writes out a copy of the MAR at src but with embedded signatures. More...
 
static void print_version (void)
 
static void print_usage (void)
 
static int mar_test_callback (MarFile *mar, const MarItem *item, void *unused)
 
static int mar_test (const char *path)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

◆ MAR_CHANNEL_ID

#define MAR_CHANNEL_ID
Value:
"LOOnlineUpdater" /* Dummy value; replace or
remove in the future */

Definition at line 26 of file mar.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

◆ mar_repackage_and_sign()

int mar_repackage_and_sign ( const char *  NSSConfigDir,
const char *const *  certNames,
uint32_t  certCount,
const char *  src,
const char *  dest 
)

Writes out a copy of the MAR at src but with embedded signatures.

The passed in MAR file must not already be signed or an error will be returned.

Parameters
NSSConfigDirThe NSS directory containing the private key for signing
certNamesThe nicknames of the certificate to use for signing
certCountThe number of certificate names contained in certNames. One signature will be produced for each certificate.
srcThe path of the source MAR file to sign
destThe path of the MAR file to write out that is signed
Returns
0 on success -1 on error

Definition at line 818 of file mar_sign.c.

References AdjustIndexContentOffsets(), BLOCKSIZE, FILE, get_mar_file_info(), HOST_TO_NETWORK64, htonl(), i, MAR_ID_SIZE, MAX_SIGNATURES, MAX_SIZE_OF_MAR_FILE, NETWORK_TO_HOST64, NSSInitCryptoContext(), NSSSignBegin(), ntohl(), NULL, ReadWriteAndUpdateSignatures(), remove(), SECU_GetModulePassword(), and WriteAndUpdateSignatures().

Referenced by main().

◆ mar_test()

static int mar_test ( const char *  path)
static

Definition at line 112 of file mar.c.

References mar_close(), mar_enum_items(), mar_open(), mar_test_callback(), and NULL.

Referenced by main().

◆ mar_test_callback()

static int mar_test_callback ( MarFile mar,
const MarItem item,
void *  unused 
)
static

Definition at line 103 of file mar.c.

References MarItem_::flags, MarItem_::length, and MarItem_::name.

Referenced by mar_test().

◆ NSSInitCryptoContext()

int NSSInitCryptoContext ( const char *  NSSConfigDir)

Initializes the NSS context.

Parameters
NSSConfigDirThe config dir containing the private key to use
Returns
0 on success -1 on error

Definition at line 35 of file mar_sign.c.

Referenced by main(), and mar_repackage_and_sign().

◆ print_usage()

static void print_usage ( void  )
static

Definition at line 45 of file mar.c.

References MAX_SIGNATURES.

Referenced by main().

◆ print_version()

static void print_version ( void  )
static

Definition at line 40 of file mar.c.

References MAR_CHANNEL_ID.

Referenced by main().