---
title: "Crypto"
canonical_url: https://developer.repebble.com/pebbleos/docs/drivers/crypto/
last_updated: 2026-11-13
sdk_version: 4.44
---
# Crypto

Source: https://developer.repebble.com/pebbleos/docs/drivers/crypto/

Crypto drivers accelerate the [crypto subsystem](https://developer.repebble.com/pebbleos/docs/subsystems/crypto.md) with a hardware hash or cipher engine. They are optional: without one, the subsystem computes everything in software.

## Interface

A driver sits under `CONFIG_CRYPTO_HW`, which the application enables, and implements the functions in `include/pbl/drivers/crypto.h` for what its hardware covers, selecting the matching hidden symbol:

| 

Symbol

 | 

Functions

 |
| --- | --- |
| 

`CONFIG_CRYPTO_SHA256_HW_ACCEL`

 | 

`pbl_crypto_hw_sha256_blocks()`

 |
| 

`CONFIG_CRYPTO_AES_HW_ACCEL`

 | 

`pbl_crypto_hw_aes_ecb_encrypt()`, `pbl_crypto_hw_aes_ecb_decrypt()`

 |

The SHA-256 function compresses whole 64-byte blocks into a running chaining value; the AES functions take the raw key and a run of 16-byte blocks. Each returns how many blocks it processed.

Returning fewer blocks than given is always allowed: the subsystem finishes in software. A driver returns 0 whenever the hardware cannot be used, such as before its device is ready, so callers never see a failure. Drivers do not check their own results: the subsystem’s [self-test](https://developer.repebble.com/pebbleos/docs/subsystems/crypto.md) does. The subsystem only calls a driver for runs of at least `CONFIG_CRYPTO_SHA256_HW_MIN_LEN` or `CONFIG_CRYPTO_AES_HW_MIN_LEN` bytes.

## Implementations

- [SF32LB](https://developer.repebble.com/pebbleos/docs/drivers/crypto/sf32lb.md)

The [API reference](https://developer.repebble.com/pebbleos/apidoc/db/d14/group __drivers__ crypto.html) documents the interface.

Generated from PebbleOS [f4926c952](https://github.com/coredevices/pebbleos/commit/f4926c952bf9b82bce9e3cdb44645a59531c0ee9). This page is maintained in the pebbleos repository: [docs/drivers/crypto/index.md](https://github.com/coredevices/pebbleos/blob/f4926c952bf9b82bce9e3cdb44645a59531c0ee9/docs/drivers/crypto/index.md).
