unleashed-firmware/applications/plugins/totp/services/crypto/memset_s.c
MX adab2b9e03
Update and fix TOTP
fix - added this in every button event switch:
default:
                    break;
2022-11-02 23:10:14 +03:00

22 lines
No EOL
445 B
C

#include "memset_s.h"
#define RSIZE_MAX 0x7fffffffffffffffUL
errno_t memset_s(void* s, rsize_t smax, int c, rsize_t n) {
if(!s || smax > RSIZE_MAX) {
return EINVAL;
}
errno_t violation_present = 0;
if(n > smax) {
n = smax;
violation_present = EINVAL;
}
volatile unsigned char* v = s;
for(rsize_t i = 0u; i < n; ++i) {
*v++ = (unsigned char)c;
}
return violation_present;
}