Another night's work - move to ECDH + AES256 from RSA pubkey
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "util.h"
|
||||
#include "rlocs.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
@@ -187,4 +186,22 @@ void session_teardown( struct session *session )
|
||||
if ( session->output_if >= 0 && !session->same_if ) {
|
||||
close( session->output_if );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: we can speed this one up, if necessary, by re-using the context.
|
||||
// TODO: some error-checking
|
||||
int sha256sum( unsigned char *src, size_t src_len, unsigned char dst[SHA256_DIGEST_LENGTH] )
|
||||
{
|
||||
unsigned int size = SHA256_DIGEST_LENGTH;
|
||||
EVP_MD_CTX *ctx = EVP_MD_CTX_create();
|
||||
EVP_DigestInit_ex( ctx, EVP_sha256(), NULL );
|
||||
|
||||
|
||||
EVP_DigestUpdate( ctx, src, src_len );
|
||||
EVP_DigestFinal_ex( ctx, &dst[0], &size );
|
||||
EVP_MD_CTX_destroy( ctx );
|
||||
|
||||
|
||||
return size == SHA256_DIGEST_LENGTH;
|
||||
}
|
Reference in New Issue
Block a user