package com.google.android.gms.internal.p002firebaseauthapi; import java.security.GeneralSecurityException; import java.util.concurrent.atomic.AtomicReference; /* loaded from: classes2.dex */ public final class zzgn { private static final zzgn zza = new zzgn(); private final AtomicReference zzb = new AtomicReference(new zzhh(new zzhb(), null)); public final zzaw zza(zzgy zzgyVar, zzca zzcaVar) { try { try { return ((zzhh) this.zzb.get()).zza(zzgyVar, zzcaVar); } catch (GeneralSecurityException e) { throw new zzhi("Creating a LegacyProtoKey failed", e); } } catch (GeneralSecurityException unused) { return new zzgg(zzgyVar, zzcaVar); } } public final void zzc(zzfv zzfvVar) throws GeneralSecurityException { synchronized (this) { zzhb zzhbVar = new zzhb((zzhh) this.zzb.get()); zzhbVar.zza(zzfvVar); this.zzb.set(new zzhh(zzhbVar, null)); } } public final void zzd(zzfz zzfzVar) throws GeneralSecurityException { synchronized (this) { zzhb zzhbVar = new zzhb((zzhh) this.zzb.get()); zzhbVar.zzb(zzfzVar); this.zzb.set(new zzhh(zzhbVar, null)); } } public final void zze(zzgr zzgrVar) throws GeneralSecurityException { synchronized (this) { zzhb zzhbVar = new zzhb((zzhh) this.zzb.get()); zzhbVar.zzc(zzgrVar); this.zzb.set(new zzhh(zzhbVar, null)); } } public final void zzf(zzgv zzgvVar) throws GeneralSecurityException { synchronized (this) { zzhb zzhbVar = new zzhb((zzhh) this.zzb.get()); zzhbVar.zzd(zzgvVar); this.zzb.set(new zzhh(zzhbVar, null)); } } public static zzgn zzb() { return zza; } }