comparison rsa.h @ 1674:ba6fc7afe1c5

use sigtype where appropriate
author Matt Johnston <matt@ucc.asn.au>
date Mon, 06 Apr 2020 23:18:26 +0800
parents 06d52bcb8094
children ae41624c2198
comparison
equal deleted inserted replaced
1668:49cb3cf4bd6f 1674:ba6fc7afe1c5
24 24
25 #ifndef DROPBEAR_RSA_H_ 25 #ifndef DROPBEAR_RSA_H_
26 #define DROPBEAR_RSA_H_ 26 #define DROPBEAR_RSA_H_
27 27
28 #include "includes.h" 28 #include "includes.h"
29 #include "signkey.h"
29 #include "buffer.h" 30 #include "buffer.h"
30 31
31 #if DROPBEAR_RSA 32 #if DROPBEAR_RSA
32 33
33 #define RSA_SIGNATURE_SIZE (4+7+4+40) 34 typedef struct dropbear_RSA_Key {
34
35 typedef struct {
36 35
37 mp_int* n; 36 mp_int* n;
38 mp_int* e; 37 mp_int* e;
39 /* d, p, and q are private parts */ 38 /* d, p, and q are private parts */
40 mp_int* d; 39 mp_int* d;
41 mp_int* p; 40 mp_int* p;
42 mp_int* q; 41 mp_int* q;
43 42
44 } dropbear_rsa_key; 43 } dropbear_rsa_key;
45 44
46 void buf_put_rsa_sign(buffer* buf, const dropbear_rsa_key *key, const buffer *data_buf); 45 void buf_put_rsa_sign(buffer* buf, const dropbear_rsa_key *key,
46 enum signkey_type sigtype, const buffer *data_buf);
47 #if DROPBEAR_SIGNKEY_VERIFY 47 #if DROPBEAR_SIGNKEY_VERIFY
48 int buf_rsa_verify(buffer * buf, const dropbear_rsa_key *key, const buffer *data_buf); 48 int buf_rsa_verify(buffer * buf, const dropbear_rsa_key *key,
49 enum signkey_type sigtype, const buffer *data_buf);
49 #endif 50 #endif
50 int buf_get_rsa_pub_key(buffer* buf, dropbear_rsa_key *key); 51 int buf_get_rsa_pub_key(buffer* buf, dropbear_rsa_key *key);
51 int buf_get_rsa_priv_key(buffer* buf, dropbear_rsa_key *key); 52 int buf_get_rsa_priv_key(buffer* buf, dropbear_rsa_key *key);
52 void buf_put_rsa_pub_key(buffer* buf, const dropbear_rsa_key *key); 53 void buf_put_rsa_pub_key(buffer* buf, const dropbear_rsa_key *key);
53 void buf_put_rsa_priv_key(buffer* buf, const dropbear_rsa_key *key); 54 void buf_put_rsa_priv_key(buffer* buf, const dropbear_rsa_key *key);