From 8df2ab7c07938c3bb24f6b44b8615f8371c0048b Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 29 Jan 2019 20:47:41 +0000 Subject: Add signing class to the pk module --- include/olm/pk.h | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'include/olm') diff --git a/include/olm/pk.h b/include/olm/pk.h index c46baa0..aed14ef 100644 --- a/include/olm/pk.h +++ b/include/olm/pk.h @@ -1,4 +1,4 @@ -/* Copyright 2018 New Vector Ltd +/* Copyright 2018, 2019 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -207,6 +207,48 @@ size_t olm_pk_get_private_key( void *private_key, size_t private_key_length ); +typedef struct OlmPkSigning OlmPkSigning; + +/* The size of a signing object in bytes */ +size_t olm_pk_signing_size(void); + +/** Initialise a signing object using the supplied memory + * The supplied memory must be at least olm_pk_sign_size() bytes */ +OlmPkSigning *olm_pk_signing( + void * memory +); + +/** A null terminated string describing the most recent error to happen to a + * signing object */ +const char * olm_pk_signing_last_error( + OlmPkSigning * sign +); + +/** Clears the memory used to back this signing object */ +size_t olm_clear_pk_signing( + OlmPkSigning *sign +); + +/** + * Initialise the signing object with a public/private keypair from a seed + */ +size_t olm_pk_signing_key_from_seed( + OlmPkSigning * sign, + void * pubkey, size_t pubkey_length, + void * seed, size_t seed_length +); + +size_t olm_pk_sign_seed_length(void); +size_t olm_pk_sign_public_key_length(void); + +size_t olm_pk_signature_length(); + +size_t olm_pk_sign( + OlmPkSigning *sign, + uint8_t const * message, size_t message_length, + uint8_t * signature, size_t signature_length +); + #ifdef __cplusplus } #endif -- cgit v1.2.3