mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:22:46 +00:00 
			
		
		
		
	 c1b041e761
			
		
	
	
		c1b041e761
		
	
	
	
	
		
			
			These changes generalize the interface with an elliptic curve implementation. This allows LibTLS to support elliptic curves generally without needing the specifics of elliptic curve implementations. This should allow for easier addition of other elliptic curves.
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			630 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			630 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Michiel Visser <opensource@webmichiel.nl>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/ByteBuffer.h>
 | |
| 
 | |
| namespace Crypto::Curves {
 | |
| 
 | |
| class EllipticCurve {
 | |
| public:
 | |
|     virtual size_t key_size() = 0;
 | |
|     virtual ErrorOr<ByteBuffer> generate_private_key() = 0;
 | |
|     virtual ErrorOr<ByteBuffer> generate_public_key(ReadonlyBytes a) = 0;
 | |
|     virtual ErrorOr<ByteBuffer> compute_coordinate(ReadonlyBytes scalar_bytes, ReadonlyBytes point_bytes) = 0;
 | |
|     virtual ErrorOr<ByteBuffer> derive_premaster_key(ReadonlyBytes shared_point) = 0;
 | |
| 
 | |
|     virtual ~EllipticCurve() = default;
 | |
| };
 | |
| 
 | |
| }
 |