1 /*
2  * Copyright (c) 2021, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <stddef.h>
9 
tfm_strnlen(const char * s,size_t maxlen)10 size_t tfm_strnlen(const char *s, size_t maxlen)
11 {
12     size_t idx;
13 
14     for (idx = 0; idx < maxlen; idx++) {
15         if (s[idx] == '\0') {
16             return idx;
17         }
18     }
19 
20     return idx;
21 }
22