Implement SSH authorized key management
This commit is contained in:
@@ -47,6 +47,27 @@ settings = "--settings" in sys.argv
|
||||
serial_settings = "--serial-settings" in sys.argv
|
||||
accounts = "--accounts" in sys.argv
|
||||
if accounts:
|
||||
HEADERS["mbedtls/base64.h"] = """
|
||||
#pragma once
|
||||
#include <stddef.h>
|
||||
#include <openssl/evp.h>
|
||||
static inline int mbedtls_base64_decode(unsigned char *out, size_t capacity, size_t *length,
|
||||
const unsigned char *in, size_t n) {
|
||||
unsigned char decoded[132];
|
||||
if (!n || n>172 || n%4) return -1;
|
||||
int result=EVP_DecodeBlock(decoded,in,(int)n);
|
||||
if (result<0) return -1;
|
||||
if (in[n-1]=='=') --result;
|
||||
if (in[n-2]=='=') --result;
|
||||
if ((size_t)result>capacity) return -1;
|
||||
memcpy(out,decoded,(size_t)result); *length=(size_t)result; return 0;
|
||||
}
|
||||
static inline int mbedtls_base64_encode(unsigned char *out, size_t capacity, size_t *length,
|
||||
const unsigned char *in, size_t n) {
|
||||
if (capacity < 4*((n+2)/3)+1) return -1;
|
||||
*length=(size_t)EVP_EncodeBlock(out,in,(int)n); return 0;
|
||||
}
|
||||
"""
|
||||
HEADERS["esp_timer.h"] += """
|
||||
#include <stdbool.h>
|
||||
typedef void *esp_timer_handle_t;
|
||||
|
||||
Reference in New Issue
Block a user