Lockitall LockIT Pro User Guide
Lockitall LockIT Pro User Guide
User Guide
Revision 3
Copyright
2013
c by
All rights reserved, including the right to reproduce
this book or portions thereof in any form whatsoever.
10 09 08 07 06 05 04 03 02 01 03 04 05 06 07
ii
Preface
About This Manual This manual is provided along with your LockIT Pro order.
It is written to allow customers to understand how their lock
functions, as well as to allow them to add new features to their
lock as they desire. We describe features of the MSP430, the
MCU on which the LockIT Pro runs, as well as additions we
have made to the MCU. We further describe the Hardware
Security Modules sent along with this shipment.
FCC Warning This equipment is intended for use in a laboratory test envi-
ronment only. It generates, uses, and can radiate radio fre-
quency energy and has not been tested for compliance with
the limits of computing devices pursuant to subpart J of part
15 of FCC rules, which are designed to provide reasonable
protection against radio frequency interference. Operation of
this equipment in other environments may cause interference
with radio communications, in which case the user at his own
expense will be required to take whatever measures may be
required to correct this interference.
iii
Contents
Preface iii
1 Introduction 1
Bibliography 15
iv
1
Introduction
1
2
Overview of the LockIT Pro
2
2.3 Memory Protection
Some version of the LockIT Pro contain memory protection which allows each
of the 256 pages to be either executable or writable, but never both. This
prevents many common attacks. There is an interrupt for the LockIT Pro
which enables memory protection, and there are interrupts to specify whether
a given page should be executable or writable.
3
3
LockIT Pro External
Hardware
While the LockIT Pro contains the circuitry to function, it does not contain
a physical lock. The door lock must be attached to output pin 7 of the MCU.
This enables the CPU to trigger software interrupt 0x7F to directly trigger
the door lock to unlock.
The door lock automatically relocks after the door has been opened, no
further commands must be sent to it.
Lockitall includes several hardware security module interfaces along with the
LockIT Pro . The first of these is the Model 1.
The Model 1 of the hardware security module contains a simple interface
which allows the MCU to test if an entered password is valid. By default, the
interrupt 0x7D will pass a given password to the HSM, and will set a byte in
memory if the password entered matches the stored password.
The stored password can be reset by detaching the HSM from the lock and
attaching it to the Model 1 reset device, also included.
4
3.3 HSM Model 2
The Model 2 of the hardware security module is a more advanced HSM, with
the ability to directly trigger the unlock functionality in the lock. The MCU
passes the lock a password, and the HSM will trigger the unlock if the password
is valid. By default, the interrupt 0x7E will pass a given password to the
HSM, and the lock will be opened if the password entered matches the stored
password.
The stored password can be reset by detaching the HSM from the lock and
attaching it to the Model 2 reset device, also included.
5
4
Developing for the LockIT
Pro
This section provides references for developing for the LockIT Pro . We de-
scribe the build process for developing C code to execute on the lock. We have
built a small C standard library, which is documented below.
4.1 Installation
6
i f ( ∗pw != ∗ buf ) return 1 ;
INT( 0 x7F ) ;
return 0 ;
}
The USB key contained with this shipment contains the object files. We
document the methods here.
INT
Declaration:
Range:
Copies at most length (including the terminating null byte) bytes from
the input device into buf.
Range:
Writes the character char to the terminal display attached to the lock.
Returns the character printed, or -1 if an error occurred.
7
getchar
Declaration:
int getchar();
puts
Declaration:
Writes the characters in buf one by one until a zero byte is reached.
printf
Declaration:
The LockIT Pro has an augmented MSP430 CPU with a callgate at address
0x10 causing a software interrupt. The interrupts are described below.
INT 0x00.
The putchar interrupt: sends a single byte to the display.
8
INT 0x01.
The getchar interrupt: reads a single byte of buffered input.
Takes no arguments.
INT 0x02.
The gets interrupt: read a specific number of bytes to standard input.
Takes two arguments. The first is the address to place the string, the
second is the maximum number of bytes to read. Null bytes are not handled
specially null-terminated.
INT 0x10.
Turn on DEP: pages are either executable or writable but never both.
Takes no arguments.
INT 0x11.
Mark as a page as either only executable or only writable.
Takes two one arguments. The first argument is the page number, the
second argument is 1 if writable, 0 if executable.
INT 0x20.
The rand interrupt: request a random 16-bit number.
Takes no arguments.
INT 0x7D.
Interface with the HSM-1. Set a flag in memory if the password passed in is
correct.
Takes two arguments. The first argument is the password to test, the
second is the location of a flag to overwrite if the password is correct.
INT 0x7E.
Interface with the HSM-2. Trigger the deadbolt unlock if the password is
correct.
9
INT 0x7F.
Interface with deadbolt to trigger an unlock if the password is correct.
Takes no arguments.
10
5
Introduction to MSP430
Assembly
r15 = r15 + 10
• The program counter, a special register that identifies the address of the
next instruction to run.
11
• The stack pointer, another special register that identifies a specific region
of memory carved out for temporary storage.
• The CPU flags, which record things like whether the last instruction
produced the value zero, or set the “sign” flag, and are used to implement
logic
• Arithmetic instructions, like “add”, compute values and store their re-
sults.
• #c The constant c.
12
6
MSP430 Assembly Reference
BIC arg1 arg2 → arg2 &= arg1 (clear the bits in arg1 from arg2)
CMP arg1 arg2 → compute arg1 - arg2, set the flags, and discard the result.
BIT arg1 arg2 → compute arg1 & arg2, set the flags, and discard the results
(like TEST on x86)
PUSH arg1 → push arg1 onto the stack; subtract 2 bytes from the SP register
(r1) and store arg1 in the resulting location in memory.
13
POP arg1 → MOV @r1+, arg1; move the value located at the stack pointer in
to arg1, and add 2 to the stack pointer.
CALL arg1 jumps to arg1, but first pushes the next address in memory (the
return address) to the stack.
14
Bibliography
15