mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 18:04:25 +09:00
pki_gcrypt: Generalize asn1_get_int
* src/pki_gcrypt.c (asn1_get): Generalize from 'asn1_get_int'. (asn1_get_int): New function simply calling 'asn1_get'. Signed-off-by: Justus Winter <justus@g10code.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
e1d36314a2
commit
38d8befcd0
@@ -112,12 +112,12 @@ static uint32_t asn1_get_len(ssh_buffer buffer) {
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssh_string asn1_get_int(ssh_buffer buffer) {
|
static ssh_string asn1_get(ssh_buffer buffer, unsigned char want) {
|
||||||
ssh_string str;
|
ssh_string str;
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
if (ssh_buffer_get_data(buffer, &type, 1) == 0 || type != ASN1_INTEGER) {
|
if (ssh_buffer_get_data(buffer, &type, 1) == 0 || type != want) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
size = asn1_get_len(buffer);
|
size = asn1_get_len(buffer);
|
||||||
@@ -138,6 +138,10 @@ static ssh_string asn1_get_int(ssh_buffer buffer) {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ssh_string asn1_get_int(ssh_buffer buffer) {
|
||||||
|
return asn1_get(buffer, ASN1_INTEGER);
|
||||||
|
}
|
||||||
|
|
||||||
static int asn1_check_sequence(ssh_buffer buffer) {
|
static int asn1_check_sequence(ssh_buffer buffer) {
|
||||||
unsigned char *j = NULL;
|
unsigned char *j = NULL;
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
|
|||||||
Reference in New Issue
Block a user