lua/lfunc.h
author Ryan C. Gordon <icculus@icculus.org>
Fri, 23 Jun 2017 17:28:03 -0400
changeset 58 1390348facc7
parent 0 d7ee4e2ed49d
permissions -rw-r--r--
Command line tool that decrypts an OPVault keychain and dumps it to stdout.

To compile: gcc -o opvault opvault.c cJSON.c -lcrypto

Usage: ./opvault </path/to/mykeychain.opvault> <password>

This is just a proof of concept; I'll be recycling this into proper OPVault
support in 1pass later and deleting this tool.

This uses OpenSSL's libcrypto for the math instead of all the homegrown
crypto this project is otherwise using. I'll probably migrate the rest in
this direction, too, since this wasn't as bad as I expected to use and
gets you all the package-manager mojo of automatic bug fixes and security
patches and shared code, etc.

cJSON parses JSON in C. That is from https://github.com/DaveGamble/cJSON

An example OPVault keychain from AgileBits is available here:

https://cache.agilebits.com/security-kb/
icculus@0
     1
/*
icculus@0
     2
** $Id: lfunc.h,v 2.8.1.1 2013/04/12 18:48:47 roberto Exp $
icculus@0
     3
** Auxiliary functions to manipulate prototypes and closures
icculus@0
     4
** See Copyright Notice in lua.h
icculus@0
     5
*/
icculus@0
     6
icculus@0
     7
#ifndef lfunc_h
icculus@0
     8
#define lfunc_h
icculus@0
     9
icculus@0
    10
icculus@0
    11
#include "lobject.h"
icculus@0
    12
icculus@0
    13
icculus@0
    14
#define sizeCclosure(n)	(cast(int, sizeof(CClosure)) + \
icculus@0
    15
                         cast(int, sizeof(TValue)*((n)-1)))
icculus@0
    16
icculus@0
    17
#define sizeLclosure(n)	(cast(int, sizeof(LClosure)) + \
icculus@0
    18
                         cast(int, sizeof(TValue *)*((n)-1)))
icculus@0
    19
icculus@0
    20
icculus@0
    21
LUAI_FUNC Proto *luaF_newproto (lua_State *L);
icculus@0
    22
LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems);
icculus@0
    23
LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems);
icculus@0
    24
LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
icculus@0
    25
LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
icculus@0
    26
LUAI_FUNC void luaF_close (lua_State *L, StkId level);
icculus@0
    27
LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
icculus@0
    28
LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv);
icculus@0
    29
LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
icculus@0
    30
                                         int pc);
icculus@0
    31
icculus@0
    32
icculus@0
    33
#endif