aboutsummaryrefslogtreecommitdiff
path: root/src/pki_gcrypt.c
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-03-14 16:31:59 +0100
committerAndreas Schneider <asn@cryptomilk.org>2016-03-21 18:39:23 +0100
commit38d8befcd0781864f8f923ae0b1f7cb2731e900d (patch)
treeb01760b694e04e4e7e53ade35bdaee90925d4151 /src/pki_gcrypt.c
parente1d36314a2e1b643d1064b3f94aa9f488d82f713 (diff)
downloadlibssh-38d8befcd0781864f8f923ae0b1f7cb2731e900d.tar.gz
libssh-38d8befcd0781864f8f923ae0b1f7cb2731e900d.tar.xz
libssh-38d8befcd0781864f8f923ae0b1f7cb2731e900d.zip
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>
Diffstat (limited to 'src/pki_gcrypt.c')
-rw-r--r--src/pki_gcrypt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pki_gcrypt.c b/src/pki_gcrypt.c
index e7e92919..22806af3 100644
--- a/src/pki_gcrypt.c
+++ b/src/pki_gcrypt.c
@@ -112,12 +112,12 @@ static uint32_t asn1_get_len(ssh_buffer buffer) {
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;
unsigned char type;
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;
}
size = asn1_get_len(buffer);
@@ -138,6 +138,10 @@ static ssh_string asn1_get_int(ssh_buffer buffer) {
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) {
unsigned char *j = NULL;
unsigned char tmp;