|
Packit |
34410b |
/*
|
|
Packit |
34410b |
*
|
|
Packit |
34410b |
* BlueZ - Bluetooth protocol stack for Linux
|
|
Packit |
34410b |
*
|
|
Packit |
34410b |
* Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
|
|
Packit |
34410b |
*
|
|
Packit |
34410b |
*
|
|
Packit |
34410b |
* This library is free software; you can redistribute it and/or
|
|
Packit |
34410b |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
34410b |
* License as published by the Free Software Foundation; either
|
|
Packit |
34410b |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
34410b |
*
|
|
Packit |
34410b |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
34410b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
34410b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
34410b |
* Lesser General Public License for more details.
|
|
Packit |
34410b |
*
|
|
Packit |
34410b |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
34410b |
* License along with this library; if not, write to the Free Software
|
|
Packit |
34410b |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
34410b |
*
|
|
Packit |
34410b |
*/
|
|
Packit |
34410b |
|
|
Packit |
34410b |
#include <stdbool.h>
|
|
Packit |
34410b |
#include <stdint.h>
|
|
Packit |
34410b |
#include <sys/uio.h>
|
|
Packit |
34410b |
|
|
Packit |
34410b |
struct bt_crypto;
|
|
Packit |
34410b |
|
|
Packit |
34410b |
struct bt_crypto *bt_crypto_new(void);
|
|
Packit |
34410b |
|
|
Packit |
34410b |
struct bt_crypto *bt_crypto_ref(struct bt_crypto *crypto);
|
|
Packit |
34410b |
void bt_crypto_unref(struct bt_crypto *crypto);
|
|
Packit |
34410b |
|
|
Packit |
34410b |
bool bt_crypto_random_bytes(struct bt_crypto *crypto,
|
|
Packit |
34410b |
void *buf, uint8_t num_bytes);
|
|
Packit |
34410b |
|
|
Packit |
34410b |
bool bt_crypto_e(struct bt_crypto *crypto, const uint8_t key[16],
|
|
Packit |
34410b |
const uint8_t plaintext[16], uint8_t encrypted[16]);
|
|
Packit |
34410b |
bool bt_crypto_ah(struct bt_crypto *crypto, const uint8_t k[16],
|
|
Packit |
34410b |
const uint8_t r[3], uint8_t hash[3]);
|
|
Packit |
34410b |
bool bt_crypto_c1(struct bt_crypto *crypto, const uint8_t k[16],
|
|
Packit |
34410b |
const uint8_t r[16], const uint8_t pres[7],
|
|
Packit |
34410b |
const uint8_t preq[7], uint8_t iat,
|
|
Packit |
34410b |
const uint8_t ia[6], uint8_t rat,
|
|
Packit |
34410b |
const uint8_t ra[6], uint8_t res[16]);
|
|
Packit |
34410b |
bool bt_crypto_s1(struct bt_crypto *crypto, const uint8_t k[16],
|
|
Packit |
34410b |
const uint8_t r1[16], const uint8_t r2[16],
|
|
Packit |
34410b |
uint8_t res[16]);
|
|
Packit |
34410b |
bool bt_crypto_f4(struct bt_crypto *crypto, uint8_t u[32], uint8_t v[32],
|
|
Packit |
34410b |
uint8_t x[16], uint8_t z, uint8_t res[16]);
|
|
Packit |
34410b |
bool bt_crypto_f5(struct bt_crypto *crypto, uint8_t w[32], uint8_t n1[16],
|
|
Packit |
34410b |
uint8_t n2[16], uint8_t a1[7], uint8_t a2[7],
|
|
Packit |
34410b |
uint8_t mackey[16], uint8_t ltk[16]);
|
|
Packit |
34410b |
bool bt_crypto_f6(struct bt_crypto *crypto, uint8_t w[16], uint8_t n1[16],
|
|
Packit |
34410b |
uint8_t n2[16], uint8_t r[16], uint8_t io_cap[3],
|
|
Packit |
34410b |
uint8_t a1[7], uint8_t a2[7], uint8_t res[16]);
|
|
Packit |
34410b |
bool bt_crypto_g2(struct bt_crypto *crypto, uint8_t u[32], uint8_t v[32],
|
|
Packit |
34410b |
uint8_t x[16], uint8_t y[16], uint32_t *val);
|
|
Packit |
34410b |
bool bt_crypto_h6(struct bt_crypto *crypto, const uint8_t w[16],
|
|
Packit |
34410b |
const uint8_t keyid[4], uint8_t res[16]);
|
|
Packit |
34410b |
bool bt_crypto_sign_att(struct bt_crypto *crypto, const uint8_t key[16],
|
|
Packit |
34410b |
const uint8_t *m, uint16_t m_len,
|
|
Packit |
34410b |
uint32_t sign_cnt, uint8_t signature[12]);
|
|
Packit |
34410b |
bool bt_crypto_gatt_hash(struct bt_crypto *crypto, struct iovec *iov,
|
|
Packit |
34410b |
size_t iov_len, uint8_t res[16]);
|