Skip to content

Commit b86f7ad

Browse files
Thalleyjhedberg
authored andcommitted
Bluetooth: SMP: Adds Kconfig for minimum encryption key size
Adds a Kconfig option to set the minimum key size accepted by this device. This can be used to e.g. enforce 128-bit keys. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
1 parent 49bd6a8 commit b86f7ad

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

subsys/bluetooth/host/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,15 @@ config BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING
509509
time a successful pairing occurs. This increases flash wear out but offers
510510
a more correct finding of the oldest unused pairing info.
511511

512+
config BT_SMP_MIN_ENC_KEY_SIZE
513+
int
514+
prompt "Minimum encryption key size accepted in octets" if !BT_SMP_SC_ONLY
515+
range 7 16
516+
default 7
517+
default 16 if BT_SMP_SC_ONLY
518+
help
519+
This option sets the minimum encryption key size accepted during pairing.
520+
512521
endif # BT_SMP
513522

514523
source "subsys/bluetooth/host/Kconfig.l2cap"

subsys/bluetooth/host/smp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct bt_smp_hdr {
3838
#define BT_SMP_OOB_NOT_PRESENT 0x00
3939
#define BT_SMP_OOB_PRESENT 0x01
4040

41-
#define BT_SMP_MIN_ENC_KEY_SIZE 7
41+
#define BT_SMP_MIN_ENC_KEY_SIZE CONFIG_BT_SMP_MIN_ENC_KEY_SIZE
4242
#define BT_SMP_MAX_ENC_KEY_SIZE 16
4343

4444
#define BT_SMP_DIST_ENC_KEY 0x01

0 commit comments

Comments
 (0)