BOLOS TEE
Macros | Functions
bolos_wallet.h File Reference

Interface to the main Bitcoin Wallet provided to third party applications. More...

Go to the source code of this file.

Macros

#define BLS_WALLET_STATE_INITIALIZED   (1 << 0)
 
#define BLS_WALLET_STATE_LOCKED   (1 << 1)
 
#define BLS_WALLET_UNLOCK_INAPP   (1 << 2)
 
#define BLS_WALLET_DERIVE_PRIVATE   (1 << 0)
 
#define BLS_WALLET_DERIVE_PUBLIC   (1 << 1)
 

Functions

int bls_wallet_get_state (void)
 Return the current state of the Bitcoin wallet. More...
 
int bls_wallet_derive (uint8_t details, const uint32_t WIDE *path, size_t pathLength, uint8_t *chainCode, bls_ecfp_private_key_t *privateKey, bls_ecfp_public_key_t *publicKey)
 Derive a Bitcoin wallet key using BIP 32. More...
 
int bls_wallet_get_address (bls_ecfp_public_key_t *publicKey, char WIDE *address, size_t addressLength, bool compressed)
 Get the Bitcoin address associated to a given public key. More...
 
int bls_wallet_call (uint8_t *apdu)
 Call the Ledger Wallet application. More...
 
int bls_wallet_approve_sign (bool status)
 Approve a signature before calling the Ledger Wallet application. More...
 

Detailed Description

Interface to the main Bitcoin Wallet provided to third party applications.

Author
Ledger Firmware Team hello.nosp@m.@led.nosp@m.ger.f.nosp@m.r
Version
1.0
Date
29th of February 2016

Using this API third party applications can interact with the Bitcoin Wallet or common provisioned secrets without revealing them

This API is only available if the TEE exposes a Bitcoin Wallet to the user

Macro Definition Documentation

#define BLS_WALLET_DERIVE_PRIVATE   (1 << 0)

Perform a BIP 32 private derivation

#define BLS_WALLET_DERIVE_PUBLIC   (1 << 1)

Perform a BIP 32 public derivation

#define BLS_WALLET_STATE_INITIALIZED   (1 << 0)

Bitcoin wallet is initialized

#define BLS_WALLET_STATE_LOCKED   (1 << 1)

Bitcoin wallet is locked

#define BLS_WALLET_UNLOCK_INAPP   (1 << 2)

Bitcoin wallet can be unlocked by the application

Function Documentation

int bls_wallet_approve_sign ( bool  status)

Approve a signature before calling the Ledger Wallet application.

This function call is specific to BOLOS TEE implementation

Parameters
[in]statustrue to approve the signature, false to reject it
Returns
1 if success, 0 if error
int bls_wallet_call ( uint8_t *  apdu)

Call the Ledger Wallet application.

This function call is specific to BOLOS TEE implementation The Ledger Wallet application is called in a special mode where the Trusted UI is disabled

Parameters
[in]apduAPDU buffer containing the command to send to the Ledger Wallet application This buffer is overwritten by the response
Returns
size of the response data and 2 bytes Status Word if success, 0 if error
int bls_wallet_derive ( uint8_t  details,
const uint32_t WIDE *  path,
size_t  pathLength,
uint8_t *  chainCode,
bls_ecfp_private_key_t privateKey,
bls_ecfp_public_key_t publicKey 
)

Derive a Bitcoin wallet key using BIP 32.

Parameters
[in]detailsDerivation method, either BLS_WALLET_DERIVE_PUBLIC or BLS_WALLET_DERIVE_PRIVATE
[in]pathBIP 32 derivation path encoded as an array of big endian integers
[in]pathLengthNumber of nodes in the provided BIP 32 derivation path
[out]chainCodeBuffer to contain the chain code or NULL
[out]privateKeyPointer to a previously initialized private key to store the derived private key
[out]publicKeyPointer to a previously initialized public key to store the derived public key
Returns
1 if success, 0 if error
int bls_wallet_get_address ( bls_ecfp_public_key_t publicKey,
char WIDE *  address,
size_t  addressLength,
bool  compressed 
)

Get the Bitcoin address associated to a given public key.

Warning
In the current API release, the version of the wallet application is used for the address version. This API will be deprecated.
Parameters
[in]publicKeyPreviously initialized Public Key
[out]addressBuffer to contain the generated address
[in]addressLengthSize of the buffer to contain the generated address
[in]compressedCompute the address for a compressed key if set to true, otherwise compute it for an uncompressed key
Returns
address length if success, 0 if error
int bls_wallet_get_state ( void  )

Return the current state of the Bitcoin wallet.

Returns
state of the wallet