-/* $OpenBSD: s3_srvr.c,v 1.101 2015/03/27 12:29:54 jsing Exp $ */
+/* $OpenBSD: s3_srvr.c,v 1.102 2015/04/15 16:25:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
if (p + i - d > n)
goto truncated;
- if ((i > 0) &&
- (ssl_bytes_to_cipher_list(s, p, i, &(ciphers)) == NULL)) {
- goto err;
+ if (i > 0) {
+ if ((ciphers = ssl_bytes_to_cipher_list(s, p, i)) == NULL)
+ goto err;
}
p += i;
-/* $OpenBSD: s3_srvr.c,v 1.101 2015/03/27 12:29:54 jsing Exp $ */
+/* $OpenBSD: s3_srvr.c,v 1.102 2015/04/15 16:25:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
if (p + i - d > n)
goto truncated;
- if ((i > 0) &&
- (ssl_bytes_to_cipher_list(s, p, i, &(ciphers)) == NULL)) {
- goto err;
+ if (i > 0) {
+ if ((ciphers = ssl_bytes_to_cipher_list(s, p, i)) == NULL)
+ goto err;
}
p += i;
-/* $OpenBSD: ssl_lib.c,v 1.102 2015/03/27 12:26:41 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.103 2015/04/15 16:25:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
STACK_OF(SSL_CIPHER) *
-ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
- STACK_OF(SSL_CIPHER) **skp)
+ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num)
{
const SSL_CIPHER *c;
- STACK_OF(SSL_CIPHER) *sk;
+ STACK_OF(SSL_CIPHER) *sk = NULL;
int i;
unsigned long cipher_id;
uint16_t cipher_value;
SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
return (NULL);
}
- if (skp == NULL || *skp == NULL) {
- sk = sk_SSL_CIPHER_new_null(); /* change perhaps later */
- if (sk == NULL)
- goto err;
- } else {
- sk = *skp;
- sk_SSL_CIPHER_zero(sk);
+
+ if ((sk = sk_SSL_CIPHER_new_null()) == NULL) {
+ SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
+ goto err;
}
for (i = 0; i < num; i += SSL3_CIPHER_VALUE_SIZE) {
}
}
- if (skp != NULL)
- *skp = sk;
return (sk);
err:
- if (skp == NULL || *skp == NULL)
- sk_SSL_CIPHER_free(sk);
+ sk_SSL_CIPHER_free(sk);
+
return (NULL);
}
-/* $OpenBSD: ssl_locl.h,v 1.89 2015/03/27 12:29:54 jsing Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.90 2015/04/15 16:25:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
const SSL_CIPHER * const *bp);
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p,
- int num, STACK_OF(SSL_CIPHER) **skp);
+ int num);
int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
unsigned char *p);
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
-/* $OpenBSD: ssl_lib.c,v 1.102 2015/03/27 12:26:41 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.103 2015/04/15 16:25:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
STACK_OF(SSL_CIPHER) *
-ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
- STACK_OF(SSL_CIPHER) **skp)
+ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num)
{
const SSL_CIPHER *c;
- STACK_OF(SSL_CIPHER) *sk;
+ STACK_OF(SSL_CIPHER) *sk = NULL;
int i;
unsigned long cipher_id;
uint16_t cipher_value;
SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
return (NULL);
}
- if (skp == NULL || *skp == NULL) {
- sk = sk_SSL_CIPHER_new_null(); /* change perhaps later */
- if (sk == NULL)
- goto err;
- } else {
- sk = *skp;
- sk_SSL_CIPHER_zero(sk);
+
+ if ((sk = sk_SSL_CIPHER_new_null()) == NULL) {
+ SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
+ goto err;
}
for (i = 0; i < num; i += SSL3_CIPHER_VALUE_SIZE) {
}
}
- if (skp != NULL)
- *skp = sk;
return (sk);
err:
- if (skp == NULL || *skp == NULL)
- sk_SSL_CIPHER_free(sk);
+ sk_SSL_CIPHER_free(sk);
+
return (NULL);
}
-/* $OpenBSD: ssl_locl.h,v 1.89 2015/03/27 12:29:54 jsing Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.90 2015/04/15 16:25:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
const SSL_CIPHER * const *bp);
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p,
- int num, STACK_OF(SSL_CIPHER) **skp);
+ int num);
int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
unsigned char *p);
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,