Print this page
9642 PKCS#11 softtoken should use explicit_bzero
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Alex Wilson <alex.wilson@joyent.com>

*** 20,33 **** * CDDL HEADER END */ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" - #include <pthread.h> #include <sys/md5.h> #include <sys/sha1.h> #include <sys/sha2.h> #include <stdlib.h> --- 20,32 ---- * CDDL HEADER END */ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2018, Joyent, Inc. */ #include <pthread.h> #include <sys/md5.h> #include <sys/sha1.h> #include <sys/sha2.h> #include <stdlib.h>
*** 560,575 **** clean_exit: (void) pthread_mutex_lock(&session_p->session_mutex); if (sign_op) { ! bzero(session_p->sign.context, sizeof (soft_hmac_ctx_t)); ! free(session_p->sign.context); session_p->sign.context = NULL; } else { ! bzero(session_p->verify.context, sizeof (soft_hmac_ctx_t)); ! free(session_p->verify.context); session_p->verify.context = NULL; } (void) pthread_mutex_unlock(&session_p->session_mutex); --- 559,572 ---- clean_exit: (void) pthread_mutex_lock(&session_p->session_mutex); if (sign_op) { ! freezero(session_p->sign.context, sizeof (soft_hmac_ctx_t)); session_p->sign.context = NULL; } else { ! freezero(session_p->verify.context, sizeof (soft_hmac_ctx_t)); session_p->verify.context = NULL; } (void) pthread_mutex_unlock(&session_p->session_mutex);