From 11f8f384f4503085a6598f3873deb113b5e3fbf9 Mon Sep 17 00:00:00 2001 From: Andrew Harding Date: Thu, 22 May 2014 16:49:27 -0600 Subject: [PATCH] fix taking address of first element of empty byte slice Change-Id: I57efec6116b688bf1aaa5da34280f76a0d9ec882 --- ciphers_gcm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ciphers_gcm.go b/ciphers_gcm.go index 2a29f5b..e21b2e5 100644 --- a/ciphers_gcm.go +++ b/ciphers_gcm.go @@ -82,7 +82,7 @@ func NewGCMEncryptionCipherCtx(blocksize int, e *Engine, key, iv []byte) ( if err != nil { return nil, err } - if iv != nil { + if len(iv) > 0 { err := ctx.setCtrl(C.EVP_CTRL_GCM_SET_IVLEN, len(iv)) if err != nil { return nil, fmt.Errorf("could not set IV len to %d: %s", @@ -106,7 +106,7 @@ func NewGCMDecryptionCipherCtx(blocksize int, e *Engine, key, iv []byte) ( if err != nil { return nil, err } - if iv != nil { + if len(iv) > 0 { err := ctx.setCtrl(C.EVP_CTRL_GCM_SET_IVLEN, len(iv)) if err != nil { return nil, fmt.Errorf("could not set IV len to %d: %s",